如何把json数据显示成ztree树
答案:1 悬赏:10 手机版
解决时间 2021-03-11 13:23
- 提问者网友:龅牙恐龙妹
- 2021-03-11 08:13
如何把json数据显示成ztree树
最佳答案
- 五星知识达人网友:洎扰庸人
- 2021-03-11 09:51
var zTreeObj,
setting = {
view: {
selectedMulti: false
}
},
//json数据
var zNodes =[
{id:4, pId:0, name:"河北省", open:false, nocheck:true},
{id:41, pId:4, name:"石家庄", open:false, nocheck:true},
{id:42, pId:4, name:"保定", open:false, nocheck:true},
{id:43, pId:4, name:"邯郸", open:false, nocheck:true},
{id:44, pId:41, name:"承德"},
{id:45, pId:42, name:"承德"},
{id:46, pId:43, name:"承德"},
{id:47, pId:43, name:"承德"},
];
//将json数据显示成ztree树
$(document).ready(function(){
zTreeObj = $.fn.zTree.init($("#tree"), setting, zNodes);
});
setting = {
view: {
selectedMulti: false
}
},
//json数据
var zNodes =[
{id:4, pId:0, name:"河北省", open:false, nocheck:true},
{id:41, pId:4, name:"石家庄", open:false, nocheck:true},
{id:42, pId:4, name:"保定", open:false, nocheck:true},
{id:43, pId:4, name:"邯郸", open:false, nocheck:true},
{id:44, pId:41, name:"承德"},
{id:45, pId:42, name:"承德"},
{id:46, pId:43, name:"承德"},
{id:47, pId:43, name:"承德"},
];
//将json数据显示成ztree树
$(document).ready(function(){
zTreeObj = $.fn.zTree.init($("#tree"), setting, zNodes);
});
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯