1
("#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
chown
  • 51,908
  • 16
  • 134
  • 170
Earls
  • 83
  • 1
  • 8

3 Answers3

5

rootNode 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;
mar10
  • 14,320
  • 5
  • 39
  • 64
2

I have got the answer:

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

var topnode = node.parent;
topnode.reloadChildren(function(topnode, isOk){});
Mark Ursino
  • 31,209
  • 11
  • 51
  • 83
DareDevil
  • 5,249
  • 6
  • 50
  • 88
0

You can read the title using:

var rootNode = $("#tree").dynatree("getRoot");  
var realRootTitle = rootNode.childList[1].data.title;
armandomiani
  • 732
  • 6
  • 16