jQuery EasyUI 中文文档(DataGrid and Tree:Tree)
Usage
Markup
Tree can be definded in <ul/> element. The markup can defines leaf and children, bellow is an example: 树可以definded在 <ul/> 元素。 该标记可以定义叶和儿童,贝娄是一个例子:
<ul id="tt"> <li> <span>Folder</span> <ul> <li> <span>Sub Folder 1</span> <ul> <li> <span><a href="#">File 11</a></span> </li> <li> <span>File 12</span> </li> <li> <span>File 13</span> </li> </ul> </li> <li> <span>File 2</span> </li> <li> <span>File 3</span> </li> </ul> </li> <li> <span>File21</span> </li> </ul>
Tree can also be defined in an empty <ul/> element: 树也可以定义在一个空 <ul/> 元素:
<ul id="tt"></ul>
jQuery
$('#tt').tree(options);
Tree data format 树中的数据格式
Every node can contains following properties: 每个节点可以包含以下属性:
- text: node text to show 文字:节点的文本显示
- id: node id, which is important to load remote data 编号:节点ID,这是很重要的远程数据加载
- state: node state, ‘open’ or ‘closed’, default is ‘open’. When set to ‘closed’, the node have children nodes and will load them from remote site 状态:节点状态,’打开’或’关闭’,默认是’打开’。当设置为’关闭’,该节点有子节点,并将它们加载远程站点
- attributes: custom attributes can be added to a node 属性:自定义属性可以被添加到一个节点
- children: an array nodes defines some children nodes 子节点:一个数组节点定义了一些子节点
Some example:
[{ text:'Folder1', iconCls:'icon-save', children:[{ text:'File1' },{ text:'Books', state:'open', attributes:{ url:'/demo/book/abc', price:100 }, children:[{ text:'PhotoShop' },{ id: 8, text:'Sub Bookds', state:'closed' }] }] },{ text:'File2' }]
Dependencies
none
Options
Override defaults with $.fn.tree.defaults.
Tree Node is a javascript object which contains following properties: 树节点是一个JavaScript对象,它包含以下属性:
- id: An identity value bind to the node. 编号:一个标识值绑定到该节点。
- text: Text to be showed. 文本:文本将显示。
- attributes: Custom attributes bind to the node. 属性:自定义属性绑定到该节点。
- target: Target DOM object. 目标:目标的DOM对象。
Properties
|
Events
|
Methods
|
原文页面:http://jquery-easyui.wikidot.com/document:tree