PDA

View Full Version : Tree data children missing second time load tree.



xjscrafter
7 Jun 2014, 1:02 PM
I'm using a tree in a dynamic UI and I call setRootNode() to set the data.

The data is below. The first time I call setRootNode() the data loads fine, but the second time I load the same data with setRootNode() the nested children ("Joes Dashboard", etc) are missing.

The strange thing is that I have the data in a class and get it from an instance of the class.

And when I step through the code, when I get the data from the class instance that has the data, Firebug tells me the children are not there.

If I place a return statement between where I get the data, and where I call setRootNode(), I can get the data any number of times, and the data is fine, but when setRootNode() is called, that's when the nested children seem to disappear.

So strange. Please help.


treeRoot: {
expanded: true,
children: [
{
text: "CUSTOM", iconCls: 'arrowTreeIcon', expanded: true, children: [
{ text: "Joes Dashboard", itemId: 'joesDashboard', iconCls: 'noTreeIcon', leaf: true },
{ text: "My First Dashboard", itemId: 'firstDashboard', iconCls: 'noTreeIcon', leaf: true}
]
},
{
text: "PRE-DEFINED", iconCls: 'arrowTreeIcon', expanded: true, children: [
{ text: "CTO View", itemId: 'ctoView', iconCls: 'noTreeIcon', leaf: true },
{ text: "IT Manager View", itemId: 'itManagerView', iconCls: 'noTreeIcon', leaf: true},
{ text: "System Engineer View", itemId: 'systemEngineerView', iconCls: 'noTreeIcon', leaf: true}
]
}
]}

xjscrafter
7 Jun 2014, 1:47 PM
SOLVED
I had to do this:


var data = JSON.parse(JSON.stringify(navTreeConfig.treeRoot));
me.getAfxNavTree().setRoot(data);


This seems like a bug in the tree panel, or in the tree store, because it should not modify the data.