我已经做了剑道UI树与外部JSON文件使用JSON速度问题剑道UI树状
这是工作的罚款,如果我有以防万一200
节点,但它正在采取太多的时间,如果我有大量数据
检查这个http://infinitelyinfinite.com/treeview/
这里是我的jQuery代码
$.getJSON("/testTree.json", function (data) {
$("#treeview").kendoTreeView({
dataSource: data
});
})
这里是我JSON
文件
[
{
"id" :100,
"text" :"Region",
"items":[
{
"id" :1,
"text" :"Asia",
"parent_id" :100,
"items":[
{
"id" :2,
"text" :"Central Asia",
"parent_id" :1,
"items":[
{
"id" :3,
"text":"Afghanistan",
"parent_id" :2,
},
{
"id" :4,
"text":"Azerbaijan",
"parent_id" :2,
}
]
},
{
"id" :5,
"text" :"East Asia",
"parent_id" : 1,
"items":[
{
"id" :6,
"text":"China"
}
]
}
]
},
{
"id" :7,
"text" :"Europe",
"parent_id" :100,
"items":[
{
"id" :8,
"text" :"Central Europe",
"parent_id" :7,
"items":[
{
"id" :9,
"text" :"Austria",
"parent_id" :8,
"items":[
{
"id" :10,
"parent_id" :9,
"text":"Carinthia"
}
]
},
{
"id" :11,
"text" :"Czech Republic",
"parent_id" :8,
"items":[
{
"id" :12,
"text":"Carinthia",
"parent_id" :11,
}
]
}
]
}
]
}
]
}
]
有没有什么办法让它快速的样品??? 它正在采取一些时间三,四十岁
您是否需要一次加载完整的树?你能找回第一大洲,地区,国家......吗?这将允许发送只需要的数据和HTML渲染将更快。 – OnaBai
@Onbai不,我不想一次加载完整的树,你可以从这里下载我的json文件[http://infinitelyinfinite.com/treeview/js/region_tree.json](http://infinitelyinfinite.com/treeview/ js/region_tree.json) –