Ember.BuTree
Summary
树组件,对Jquery Ztree进行简单的封装
使用方式
{{bu-tree options=view.treeOptions zNodes=view.zNodes}}
对应的View文件为
Tree View
export default Ember.View.extend({
init: function () {
this._super.apply(this,arguments);
this.set('treeOptions', {
onClick:function(component, event, treeId, treeNode, clickFlag){
//your code
}
});
this.set('zNodes', [
{ name: "父节点1 - 展开", open: true,
children: [
{ name: "父节点11 - 折叠",
children: [
{ name: "叶子节点111"},
{ name: "叶子节点112"},
{ name: "叶子节点113"},
{ name: "叶子节点114"}
]},
{ name: "父节点12 - 折叠",
children: [
{ name: "叶子节点121"},
{ name: "叶子节点122"},
{ name: "叶子节点123"},
{ name: "叶子节点124"}
]},
{ name: "父节点13 - 没有子节点", isParent: true}
]},
{ name: "父节点2 - 折叠",
children: [
{ name: "父节点21 - 展开", open: true,
children: [
{ name: "叶子节点211"},
{ name: "叶子节点212"},
{ name: "叶子节点213"},
{ name: "叶子节点214"}
]},
{ name: "父节点22 - 折叠",
children: [
{ name: "叶子节点221"},
{ name: "叶子节点222"},
{ name: "叶子节点223"},
{ name: "叶子节点224"}
]},
{ name: "父节点23 - 折叠",
children: [
{ name: "叶子节点231"},
{ name: "叶子节点232"},
{ name: "叶子节点233"},
{ name: "叶子节点234"}
]}
]},
{ name: "父节点3 - 没有子节点", isParent: true}
]
);
}
});
Warning: *组件重写了callback函数方法,加入了一层代理功能,第一个参数为component实例,用于与Ember交互,其他参数与zTree一致
详细API DEMO 见 Ztree查看更多...
Item Index
Properties
Methods
_destroyElement
Syntax
_destroyElement
()
private
Summary
在Component销毁时,销毁树的实例
_parseOptions
Syntax
_parseOptions
()
private
Summary
如果options是模板中传入的字符串,尝试将字符串转换为options对象
_updateDom
Syntax
_updateDom
()
private
Summary
在插入Dom后,生成Tree组件
getTree
Syntax
getTree
()
Summary
返回zTree实例
Returns:
:
Properties
defaultTemplate
Syntax
defaultTemplate
Function
Summary
默认模板
Default: ''
options
Syntax
options
Object
Summary
ztree配置项
Default: {}
treeId
Syntax
treeId
String
Summary
elementId的别名
Default: elementId
zNodes
Syntax
zNodes
Object
Summary
树所绑定的数据
Default: null