码迷,mamicode.com
首页 > Web开发 > 详细

添加json属性并赋值或修改json属性(ztree树形结构)

时间:2017-11-16 19:40:39      阅读:292      评论:0      收藏:0      [点我收藏+]

标签:time   size   use   i++   modify   child   max   account   col   

var data=[
    {accounts :[],
    attrs : {maxmailboxsize: "-1", maxusers: "-1"},
    fullpath : "",id :"og59fdbc30578",
    modifytime : "", name:"123", poid : "", children : []
},
    {accounts :[],
        attrs : {maxmailboxsize: "-1", maxusers: "-1"},
        fullpath : "",id :"og59fdbc30578",
        modifytime : "",
        name:"开发部",
        poid : "",
        children : [{
            accounts :[],
            attrs : {maxmailboxsize: "开发部1", maxusers: "-1"},
            fullpath : "",id :"og59fdbc30578",
            modifytime : "",
            name:"开发部1",
            poid : "",
            children : [{accounts :[],
                attrs : {maxmailboxsize: "开发部11", maxusers: "-1"},
                fullpath : "",id :"og59fdbc30578",
                modifytime : "",
                name:"开发部11",
                poid : "",
                children : [{
                    accounts :[],
                    attrs : {maxmailboxsize: "-1", maxusers: "-1"},
                    fullpath : "",id :"og59fdbc30578",
                    modifytime : "",
                    name:"开发部111",
                    poid : "",
                    children : [{
                        accounts :[],
                        attrs : {maxmailboxsize: "-1", maxusers: "-1"},
                        fullpath : "",id :"og59fdbc30578",
                        modifytime : "",
                        name:"开发部1111",
                        poid : "",
                        children : [{
                            accounts :[],
                            attrs : {maxmailboxsize: "-1", maxusers: "-1"},
                            fullpath : "",id :"og59fdbc30578",
                            modifytime : "",
                            name:"开发部1111",
                            poid : "",
                            children : [{
                                accounts :[],
                                attrs : {maxmailboxsize: "-1", maxusers: "-1"},
                                fullpath : "",id :"og59fdbc30578",
                                modifytime : "",
                                name:"开发部111111",
                                poid : "",
                                children : []
                            }]
                        }]
                    }]
                }]
            }]
        }]
    }
];

if(data != "" && data.length>0){
    for(var i=0;i<data.length;i++){
      console.log(data[i]);
      var s = data[i];
      s["subditems"]=s.children;
        console.log(s);
    }
}
console.log(data);

 

添加json属性并赋值或修改json属性(ztree树形结构)

标签:time   size   use   i++   modify   child   max   account   col   

原文地址:http://www.cnblogs.com/zsy0712/p/7845862.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!