0
votes

expand/collapse icon is not shown after adding the child node to tree panel in extjs.

here i have a scenario where i get only immediate childrens of the node. on getting the immediate childrens i want to add those to the selected node.

i can add the child nodes but the expand/collapse icon does not come up after adding the node.

following is my code.

onItemExpand : function(nodeinterface,eOpts)
{
    if(!nodeinterface.hasChildNodes())
    {
        nodeinterface.appendChild(dataFromES[0]);
    }
}

here the data contains the property leaf:false so that it can have more childs.

any help is really appreciated.

Thanks

2
What version ExtJS are you using?Andrew Lapham

2 Answers

0
votes

Set the parent node (in your case the nodeinterface variable) "leaf" property to false before you append a new child.

if(!nodeinterface.hasChildNodes())
{
    nodeinterface.set('leaf', false);
    nodeinterface.appendChild(dataFromES[0]);
}
0
votes

I've experienced the same problem and in my case the problem was related with the lack of the id property in the nodes.

I've added a random id when creating the nodes to append and then the expand/collapse icon is properly shown.

Alex