我已经用外部 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,
}
]
}
]
}
]
}
]
}
]
有什么办法让它快吗???需要一些时间 30S 或 40S