admin管理员组文章数量:1313781
("#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...)
So I do:
var rootNode = $("#tree").dynatree("getRoot");
var title = rootNode.data.title;
title = null
... ok, so I try:
var rootNode = $("#tree").dynatree("getRoot");
var node = rootNode.getChildren();
var title = node.data.title;
Cannot read property 'title' of undefined
If I just:
alert(node);
I get:
DynaTreeNode<location.92>: 'First Location'
So...?
And since I'm asking, in console:
jquery.dynatree.min.js:710:49:53.215 - Option 'title' is no longer supported.
?
Related?
Uncaught TypeError: Cannot read property 'parentNode' of null
ra
("#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...)
So I do:
var rootNode = $("#tree").dynatree("getRoot");
var title = rootNode.data.title;
title = null
... ok, so I try:
var rootNode = $("#tree").dynatree("getRoot");
var node = rootNode.getChildren();
var title = node.data.title;
Cannot read property 'title' of undefined
If I just:
alert(node);
I get:
DynaTreeNode<location.92>: 'First Location'
So...?
And since I'm asking, in console:
jquery.dynatree.min.js:710:49:53.215 - Option 'title' is no longer supported.
?
Related?
Uncaught TypeError: Cannot read property 'parentNode' of null
ra
Share
Improve this question
edited Nov 8, 2011 at 20:00
chown
52.8k17 gold badges137 silver badges170 bronze badges
asked Dec 30, 2010 at 15:53
EarlsEarls
1831 silver badge8 bronze badges
3 Answers
Reset to default 5rootNode is the (invisible) system root and rootNode.data.title
is not set.
Since node.getChildren() returns a list, it should be
var rootNode = $("#tree").dynatree("getRoot");
var nodeList = rootNode.getChildren();
var title = nodeList[0].data.title;
I have got the answer:
//node = item which has isFolder() = false, islazy() = false
var topnode = node.parent;
topnode.reloadChildren(function(topnode, isOk){});
You can read the title using:
var rootNode = $("#tree").dynatree("getRoot");
var realRootTitle = rootNode.childList[1].data.title;
本文标签: javascriptDynaTree root node nullundefinedchildren undefinedStack Overflow
版权声明:本文标题:javascript - DynaTree root node nullundefined - children undefined - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741956179a2407000.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论