1
我有一個完整的樹多個項目,多層次,樹是建立與Ajax調用和使用惰性節點擴大的keyPath與惰性加載
所以現在我想添加的功能,所以我的樹可以加載和選擇和項目,如果我給完整的路徑,但在我可以選擇我需要確保項目加載延遲加載的項目之前,我可以訪問它。
我發現功能.loadKeypath(),所以用於測試i相
node.getKeyPath();
檢索到我的節點的完整路徑,因此路徑是/ 12/16 /18分之17
所以我想通了,我應該把這個代碼AJAX數據在
onPostInit: function(isReloading, isError){
$("#tree").dynatree("getTree").loadKeyPath("/12/16/17/18", function(node, status){
if(status == "loaded") {
// 'node' is a parent that was just traversed.
// If we call expand() here, then all nodes will be expanded
// as we go
node.expand();
}else if(status == "ok") {
// 'node' is the end node of our path.
// If we call activate() or makeVisible() here, then the
// whole branch will be exoanded now
node.activate();
}else if(status == "notfound") {
var seg = arguments[2],
isEndNode = arguments[3];
}
});
}
加載之後,但現在我在控制檯中這樣的警告:
Node not found: 12 jquery.dynatree.js:49
ADN這是一個完整日誌
9:12:27.862 - Dynatree._create(): version='$Version: 1.2.0$', debugLevel=2. jquery.dynatree.js:52
9:12:27.865 - DynaTree.persistence:
Object
jquery.dynatree.js:52
9:12:27.867 - Dynatree._load(): read tree structure... jquery.dynatree.js:52
9:12:27.868 - Dynatree._init(): send Ajax request... jquery.dynatree.js:52
9:12:27.869 - Class.create.removeChildren(false) jquery.dynatree.js:52
9:12:27.876 - Dynatree._load(): render nodes... jquery.dynatree.js:52
9:12:27.877 - Dynatree._load(): bind events... jquery.dynatree.js:52
9:12:27.885 - Dynatree._load(): postInit... jquery.dynatree.js:52
9:12:27.887 - Dynatree._init(): done. jquery.dynatree.js:52
9:12:27.889 - ui.dynatree._init() was called; no current default functionality. jquery.dynatree.js:52
9:12:29.483 - Removed leading root key. jquery.dynatree.js:52
9:12:29.484 - Class.create._loadKeyPath(12/16/17/18) jquery.dynatree.js:52
9:12:29.484 - Node not found: 12 jquery.dynatree.js:49
9:12:29.485 - trigger nodeLoaded.dynatree.tree._1 jquery.dynatree.js:52
9:12:29.485 - dtnode._expand(true) IGNORED -
Class.create
jquery.dynatree.js:52
那麼,如何可以加載哪些那朵嵌套在其他節點
你如何得到這個字符串:所以路徑是/ 12/16/17/18? node.getKeyPath()不能被我調用,因爲我的節點爲空... – HelloWorld