easyui tree自定义属性用法
2024-10-19 01:19:42
easyui为树显示提供了以下属性,
id:节点id,这个很重要到加载远程服务器数据 which is important to load remote data
text: 显示的节点文本
state: 节点状态, 'open' 或者 'closed', 默认是 'open'. 当设置为 'closed', 节点所有的子节点将从远程服务器站点加载
checked: 指明检查节点是否选中.
要想在树点击事件中获取这些属性以外的属性怎么办呢,如点击树节点的时候想获取一个跟这个节点关联的对象id又该怎么做呢,easyui tree json数据提供了自定义属性来解决这个问题。
attributes: 可以添加到节点的自定义属性
attributes是一个对象,任何自定义属性都可以以json键值对的形式放里面 attributes: {'pkid':'ssddd','url':'a.html'}
[{
"id":1,
"text":"根类",
"attributes":{"url":""},
"children":[{
"id":11,
"text":"系统类",
"attributes":{"url":""},
"children":[{
"id":110,
"text":"操作类",
"attributes":{"url":"manage/class/class.html"}
},{
"id":112,
"text":"模块类",
"attributes":{"url":"manage/class/class.html"}
},{
"id":113,
"text":"人员类",
"attributes":{"url":"manage/class/class.html"}
}]
}
}]
那该怎么取这些自定义属性值呢?参照下面
onClick:function(node)
{
var tabTitle =node.text;
var id = node.id;
var url=node.attributes.url;
var icon = node.iconCls;
if(url){
//addTab(id,tabTitle, url, icon);
}
}
最新文章
- Go build constraints
- 【MongoDB】 Windows 安装
- C#固定时间执行指定事件(观察者模式+异步委托)
- java中string stringbuilder stringbuffer 的区别
- 纯css径向渐变(CSS3--Gradient)
- jack报错
- hive数据文件简单合并
- EMVTag系列3《持卡人基本信息数据》
- Eclipse代码自动填充.
- 关于MongoDB数据库中文件唯一性的问题
- 查找 SqlServer死锁
- 百分比相对计算注意事项CSS3
- 剑指Offer_4_二维数组中的查找
- HDU 2412 Farm Irrigation
- Baidu音乐爬虫
- PHP过滤数组中的空值
- 运用jieba库 寻找高频词
- 安装ruby及sass
- linux shell 多个命令一起执行的几种方法
- mysql5.6.40单实例安装二进制快捷安装
热门文章
- 条件注释判断浏览器<;!--[if !IE]>;
- 使 PHP 写的网站看上去像 asp 页面
- 微软笔试Highway问题解析
- HDU 4642 Fliping game (2013多校4 1011 简单博弈)
- 应用 TransactionScope 报:此操作对该状态的事务无效 的错误
- zk选举过程
- SecureCRT connecting VM Linux show error message: The remote system refused the connection.
- Struct2_定义拦截器并使用注解方式作用在Action的方法中
- win7注册表损坏的修复方法
- 网络工程师岗位基础面试题【适用于CCNA/CCNP基础】