jQuery EasyUI API 中文文档 - Tree树使用介绍
用 $.fn.tree.defaults 重写了 defaults。
依赖
draggable
droppable
用法
Tree 能在 <ul> 元素里定义,此标记可以定义为叶节点和子节点。下面是一个示例:
<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 也可以在一个空的 <ul> 元素里定义。
<ul id="tt"></ul>
url:'tree_data.json'
});
树数据的格式(Tree data format)
每个节点可以包含下列特性:
id:节点的 id,它对于加载远程数据很重要。
text:显示的节点文字。
state:节点状态, 'open' 或 'closed',默认是 'open'。当设为 'closed' 时,此节点有子节点,并且将从远程站点加载它们。
checked:指示节点是否被选中。 Indicate whether the node is checked selected.
attributes:给一个节点追加的自定义属性。
children:定义了一些子节点的节点数组。
示例:
"id":1,
"text":"Folder1",
"iconCls":"icon-save",
"children":[{
"text":"File1",
"checked":true
},{
"text":"Books",
"state":"open",
"attributes":{
"url":"/demo/book/abc",
"price":100
},
"children":[{
"text":"PhotoShop",
"checked":true
},{
"id": 8,
"text":"Sub Bookds",
"state":"closed"
}]
}]
},{
"text":"Languages",
"state":"closed",
"children":[{
"text":"Java"
},{
"text":"C#"
}]
}]
特性
|
名称 |
类型 |
说明 |
默认值 |
|
url |
string |
获取远程数据的 URL 。 |
null |
|
method |
string |
获取数据的 http method 。 |
post |
|
animate |
boolean |
定义当节点展开折叠时是否显示动画效果。 |
false |
|
checkbox |
boolean |
定义是否在每个节点前边显示 checkbox 。 |
false |
|
cascadeCheck |
boolean |
定义是否级联检查。 |
true |
|
onlyLeafCheck |
boolean |
定义是否只在叶节点前显示 checkbox 。 |
false |
|
dnd |
boolean |
定义是否启用拖放。 |
false |
|
data |
array |
加载的节点数据。 |
null |
事件
很多事件的回调函数需要 'node' 函数,它包含下列特性:
- id:绑定到节点的标识值。
- text:显示的文字。
- checked:是否节点被选中。
- attributes:绑定到节点的自定义属性。
- target:目标的 DOM 对象。
|
名称 |
参数 |
说明 |
|
onClick |
node |
当用户点击一个节点时触发, node 参数包含下列特性: |
|
onDblClick |
node |
当用户双击一个节点时触发。 |
|
onBeforeLoad |
node, param |
当加载数据的请求发出前触发,返回 false 就取消加载动作。 |
|
onLoadSuccess |
node, data |
当数据加载成功时触发。 |
|
onLoadError |
arguments |
当数据加载失败时触发, arguments 参数与 jQuery.ajax 的'error' 函数一样。. |
|
onBeforeExpand |
node |
节点展开前触发,返回 false 就取消展开动作。 |
|
onExpand |
node |
当节点展开时触发。 |
|
onBeforeCollapse |
node |
节点折叠前触发,返回 false 就取消折叠动作。 |
|
onCollapse |
node |
当节点折叠时触发。 |
|
onCheck |
node, checked |
当用户点击 checkbox 时触发。 |
|
onBeforeSelect |
node |
节点被选中前触发,返回 false 就取消选择动作。 |
|
onSelect |
node |
当节点被选中时触发。 |
|
onContextMenu |
e, node |
当右键点击节点时触发。 |
|
onDrop |
target, source, point |
当节点被拖拽施放时触发。 |
|
onBeforeEdit |
node |
编辑节点前触发。 |
|
onAfterEdit |
node |
编辑节点后触发。 |
|
onCancelEdit |
node |
当取消编辑动作时触发。 |
方法
|
名称 |
参数 |
说明 |
|
options |
none |
返回树的 options。 |
|
loadData |
data |
加载树的数据。 |
|
getNode |
target |
获取指定的节点对象。 |
|
getData |
target |
获取指定的节点数据,包括它的子节点。 |
|
reload |
target |
重新加载树的数据。 |
|
getRoot |
none |
获取根节点,返回节点对象。 |
|
getRoots |
none |
获取根节点们,返回节点数组。 |
|
getParent |
target |
获取父节点, target 参数指节点的 DOM 对象。 |
|
getChildren |
target |
获取子节点, target 参数指节点的 DOM 对象。 |
|
getChecked |
none |
获取所有选中的节点。 |
|
getSelected |
none |
获取选中的节点并返回它,如果没有选中节点,就返回 null。 |
|
isLeaf |
target |
把指定的节点定义成叶节点, target 参数表示节点的 DOM 对象。 |
|
find |
id |
找到指定的节点并返回此节点对象。 |
|
select |
target |
选中一个节点, target 参数表示节点的 DOM 对象。 |
|
check |
target |
把指定节点设置为勾选。 |
|
uncheck |
target |
把指定节点设置为未勾选。 |
|
collapse |
target |
折叠一个节点, target 参数表示节点的 DOM 对象。 |
|
expand |
target |
展开一个节点, target 参数表示节点的 DOM 对象。 |
|
collapseAll |
target |
折叠所有的节点们。 |
|
expandAll |
target |
展开所有的节点们。 |
|
expandTo |
target |
从指定节点的根部展开。 |
|
append |
param |
追加一些子节点们到一个父节点, param 参数有两个特性: |
|
toggle |
target |
切换节点的展开/折叠状态, target 参数表示节点的 DOM 对象。 |
|
insert |
param |
在指定节点的前边或后边插入一个节点, param 参数包含下列特性: |
|
remove |
target |
移除一个节点和它的子节点们, target 参数表示节点的 DOM 对象。 |
|
pop |
target |
弹出一个节点和它的子节点们,此方法和 remove 一样,但是返回了移除的节点数据。 |
|
update |
param |
跟心指定的节点, param 参数有下列特性: |
|
enableDnd |
none |
启用拖放功能。 |
|
disableDnd |
none |
禁用拖放功能。 |
|
beginEdit |
nodeEl |
开始编辑节点。 |
|
endEdit |
nodeEl |
结束编辑节点。 |
|
cancelEdit |
nodeEl |
取消编辑节点。 |
jQuery EasyUI API 中文文档 - Tree树使用介绍的更多相关文章
- jQuery EasyUI API 中文文档
http://www.cnblogs.com/Philoo/tag/jQuery/ 共2页: 1 2 下一页 jQuery EasyUI API 中文文档 - 树表格(TreeGrid) 风流涕淌 ...
- jQuery EasyUI API 中文文档 - ComboGrid 组合表格
jQuery EasyUI API 中文文档 - ComboGrid 组合表格,需要的朋友可以参考下. 扩展自 $.fn.combo.defaults 和 $.fn.datagrid.defaults ...
- jQuery EasyUI API 中文文档 - ValidateBox验证框
jQuery EasyUI API 中文文档 - ValidateBox验证框,使用jQuery EasyUI的朋友可以参考下. 用 $.fn.validatebox.defaults 重写了 d ...
- jQuery EasyUI API 中文文档 - Panel面板
<html> <head> <title>布局管理器--控制面板</title> <script src="jquery-easyui/ ...
- jquery easyui 弹出消息框 (转载) jQuery EasyUI API 中文文档 - 消息框(Messager) http://www.cnblogs.com/hantianwei/archive/2012/03/19/2407113.html
<html> <head> <!-- 导入easyui插件的js和css样式; --> <link rel="stylesheet" ty ...
- jQuery EasyUI API 中文文档 - 分隔按钮(splitbutton)
<html> <head> <script src="jquery-easyui/jquery.min.js"></script> ...
- jQuery EasyUI API 中文文档 - 菜单按钮(menubutton)
<html> <head> <script src="jquery-easyui/jquery.min.js"></script> ...
- jQuery EasyUI API 中文文档 - 链接按钮(linkbutton)
<html> <head> <script src="jquery-easyui/jquery.min.js"></script> ...
- jQuery EasyUI API 中文文档 - 布局(Layout)
<html> <head> <script src="jquery-easyui/jquery.min.js"></script> ...
随机推荐
- FastDFS的配置、部署与API使用解读(7)Nginx的FastDFS模块(转)
1.Nginx的FastDFS模块什么作用? 我们在使用FastDFS部署一个分布式文件系统的时候,通过FastDFS的客户端API来进行文件的上传.下载.删除等操作.同时通过 FastDFS的HTT ...
- jQuery UI Autocomplete是jQuery UI的自动完成组件
支持的数据源 jQuery UI Autocomplete主要支持字符串Array.JSON两种数据格式. 普通的Array格式没有什么特殊的,如下: ? 1 ["cnblogs" ...
- mysql 中alter语句中change跟modify的区别
mysql 中alter语句中change和modify的区别可以使用CHANGE old_col_name column_definition子句对列进行重命名.重命名时,需给定旧的和新的列名称和列 ...
- EasyDarwin开源流媒体云平台支持EasyCamera摄像机、EasyCamera手机直播监控、EasyNVR等多终端接入
云平台架构 EasyDarwin开源流媒体云平台目前已经包括了EasyCMS中心管理服务.EasyDarwin流媒体服务.EasyCamera设备端(支持Arm_Linux.Android.PC).E ...
- 无法启动FTP站点,服务目前停止
在本地搭建了一个FTP服务器(windows搭建FTP服务器实战),再启动的时候提示错误: 错误提示信息: 根据提示可以查出问题原因:FTP服务没有开启 启动服务,再次重启站点服务.一切OK. 亲测好 ...
- SVN在myeclipse中新建地址的时出现被拒绝
新建资源库地址: 控制台提示信息: svn: connection refused by the server svn: connection refused by the server Connec ...
- ubuntu搭建nginx
1.下载nginx压缩包 2.上传.解压 tar -zxvf nginx-1.8.0.tar.gz cd nginx-1.8.0 3.安装 make install 4.启动,停止 ,重启 服务 可 ...
- HTML5与php实现消息推送功能
1.html页面basic_sse.html <!DOCTYPE html> <html lang="en"> <head> <meta ...
- 配置composer代理
composer config -g repo.packagist composer https://packagist.phpcomposer.com
- TP框架中的多种方法代码(C,G,L,T,I,N,D,M,A,R,B,U,W,S,F,E)
C方法 function C($name=null, $value=null,$default=null) { static $_config = array(); // 无参数时获取所有 if (e ...