質問

("#tree").dynatree({                
minExpandLevel: 1,              
//persist: true,                
children: [{"title":"First Location",
"isFolder":true,
"expand":true,
"key":"location.92",
"icon":"location.gif",
"children":[{"title":"<span class='assetType'>First Location Child<\/span>",
"key":"locationid=92&typeid=1",
"expand":true,
"icon":"equipment.gif",
"children":[ (etc...)

私もです:

var rootNode = $("#tree").dynatree("getRoot");
var title = rootNode.data.title;

title = null

...わかりました、だから私はやってみます:

var rootNode = $("#tree").dynatree("getRoot");
var node = rootNode.getChildren();
var title = node.data.title;

未定義のプロパティ「タイトル」を読むことはできません

私がただの場合:

alert(node);

わかりました:

dynatreenodeu003Clocation.92> :「最初の場所」

それで...?

そして、私が尋ねてから、コンソールで:

jquery.dynatree.min.js:710:49:53.215 - Option 'title' is no longer supported.

?

関連している?

Uncaught TypeError: Cannot read property 'parentNode' of null
ra
役に立ちましたか?

解決

ルートノードは(目に見えない)システムルートです rootNode.data.title 設定されていません。 node.getChildren()はリストを返すため、

var rootNode = $("#tree").dynatree("getRoot");
var nodeList = rootNode.getChildren();
var title = nodeList[0].data.title;

他のヒント

答えがあります:

//node = item which has isFolder() = false, islazy() = false

var topnode = node.parent;
topnode.reloadChildren(function(topnode, isOk){});

使用を使用してタイトルを読むことができます。

var rootNode = $("#tree").dynatree("getRoot");  
var realRootTitle = rootNode.childList[1].data.title;
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top