• easyui tree自定义属性用法


    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);    
                    }
                }
  • 相关阅读:
    mysql
    makefile
    KNN算法(k-nearest neighbor)
    时间序列
    python易错题之lambda 以及 for循环中内嵌函数
    python易错题之作用域
    html----不常见标签
    js----DOM对象(3
    js----DOM对象(事件)
    js----对象
  • 原文地址:https://www.cnblogs.com/langhua/p/3700572.html
Copyright © 2020-2023  润新知