hao1053464525
闪亮的塔科特
2017-08-15 09:26

jstree的creat_node方法使用

  • jstree

我写了一下代码:
$(document).ready(function(){
$("#sd").jstree({
core: {
themes: {url: true, dir: '/jstree'},
animation: false,
multiple: false,
dblclick_toggle: false,
check_callback: true,
data: [{
text: "Program List",
type: "level_root",
id: "root_inputs",
icon: "glyphicon glyphicon-list-alt",
state: {
opened: true
},
children: []
}]
},
types: {
"#": {
valid_children: ["level_root"]
},
"level_root": {
valid_children: ["level_time"]
},
"level_time": {
valid_children: ["level_program"]
},
"level_program": {
valid_children: []
}
},
plugins: ["themes","sort","types"]
})
;
var input=[
{num:"Channel1"},
{num:"Channel2"},
{num:"Channel3"},
{num:"Channel4"},
{num:"Channel5"},
{num:"Channel6"},
{num:"Channel7"},
{num:"Channel8"}
];
for(var key in input){
var node={
text:input[key].num,
icon:"glyphicon glyphicon-folder-close",
children:[],
type:"level_time",
state: {
opened: false
}

            };
            $("#sd").jstree().create_node("root_inputs",node);
        }
    })
            为什么浏览器加载时我发显示2级文件夹,但用火狐的浏览器打断点就可以加载出来,是因为creat_node的方法有延迟吗。
  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

0条回答

为你推荐

换一换