私は複数のアイテムと複数のレベルを持つ完全なツリーを持っています、ツリーはajax呼び出しで構築され、レイジーノードを使用します
だから今、私はフルパスを与えれば私のツリーがロードして選択できるように関数を追加したいのですが、アイテムを選択する前に、アイテムが遅延ロードでロードされていることを確認してアクセスできるようにする必要があります。
関数.loadKeypath()を見つけたので、テストのために、ノードへのフルパスを次のように取得しました。
node.getKeyPath();
したがって、パスは/12/16/17/18です。
だから私は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
では、他のノードにネストされているノードをロードするにはどうすればよいですか?