easyui tree樹元件無限迴圈
阿新 • • 發佈:2019-02-16
在學習jquery easyui的tree元件的時候,在url為連結地址的時,發現如果最後一個節點的state為closed時,未節點顯示為資料夾,單擊會重新載入動態(Url:連結地址)形成無限迴圈。如:
tree.json
[{
"id":1,
"text":"Folder1",
"iconCls":"icon-save",
"children":[{
"text":"File1",
"checked":true
},{
"text":"Books",
"state ":"open",
"attributes":{
"url":"/demo/book/abc",
"price":100
},
"children":[{
"text":"PhotoShop",
"checked":true,
"state":"closed"
},{
"id": 8,
"text":"Sub Bookds" ,
"state":"open"
}]
}]
}]
$('#box').tree({
url :"tree.json",
cascadeCheck : false,
onlyLeafCheck : true,
lines : true,
formatter : function (node) {
return '[' + node.text + ']';
}
});
- tree元件無限迴圈截圖
解決方法:把末節點State狀態設為open可正常顯示