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);
}
}

最新文章

  1. Go build constraints
  2. 【MongoDB】 Windows 安装
  3. C#固定时间执行指定事件(观察者模式+异步委托)
  4. java中string stringbuilder stringbuffer 的区别
  5. 纯css径向渐变(CSS3--Gradient)
  6. jack报错
  7. hive数据文件简单合并
  8. EMVTag系列3《持卡人基本信息数据》
  9. Eclipse代码自动填充.
  10. 关于MongoDB数据库中文件唯一性的问题
  11. 查找 SqlServer死锁
  12. 百分比相对计算注意事项CSS3
  13. 剑指Offer_4_二维数组中的查找
  14. HDU 2412 Farm Irrigation
  15. Baidu音乐爬虫
  16. PHP过滤数组中的空值
  17. 运用jieba库 寻找高频词
  18. 安装ruby及sass
  19. linux shell 多个命令一起执行的几种方法
  20. mysql5.6.40单实例安装二进制快捷安装

热门文章

  1. 条件注释判断浏览器<!--[if !IE]>
  2. 使 PHP 写的网站看上去像 asp 页面
  3. 微软笔试Highway问题解析
  4. HDU 4642 Fliping game (2013多校4 1011 简单博弈)
  5. 应用 TransactionScope 报:此操作对该状态的事务无效 的错误
  6. zk选举过程
  7. SecureCRT connecting VM Linux show error message: The remote system refused the connection.
  8. Struct2_定义拦截器并使用注解方式作用在Action的方法中
  9. win7注册表损坏的修复方法
  10. 网络工程师岗位基础面试题【适用于CCNA/CCNP基础】