我已經做了劍道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) –