[英]JStree: How to set state of AJAX-loaded root nodes to undetermined
我正在使用jstree v3.0.2來顯示帶有三態復選框(選中,未選中,不確定)的節點樹,該復選框通過AJAX調用以JSON格式加載。 當用戶擴展節點時,僅根節點被加載,子節點按需加載。 因此,我們尚不知道(未)檢查節點的哪些子節點,但是根節點必須根據基礎子節點進行檢查,未檢查或不確定。
我的問題與這一問題非常相似,希望可以使我的問題更容易理解,但該問題似乎與較舊的版本有關,並且不考慮節點的延遲加載。 同樣, 最后一個建議使用“不確定”狀態的答案似乎不起作用。
最初加載的JSON(用於最頂層的根節點)如下所示:
[{
"id":"100",
"parent":"#", // Indicates this is a topmost root node
"text":"test1",
"children":false, // Wether or not the node has children
"state":{
"selected":true, // Node is selected
"partial_selection":false // Node state >should be< undetermined
}
},{
"id":"101",
"parent":"#",
"text":"test2",
"children":true,
"state":{
"selected":true,
"partial_selection":true
}
},{
"id":"102",
"parent":"#",
"text":"test3",
"children":true,
"state":{
"selected":false
}
}]
有沒有人找到解決這個問題的方法?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.