View Full Version : Tree panel collapse all & expand all - problem

18 Mar 2012, 8:54 PM
Hi ,

I am facing problem in tree panel collapse all and expand all.

When the tree panel has less data , its working fine.

When the tree panel has large date , its not working

i am using this code to expand and collapse


can you please help me to fix this problem?

19 Mar 2012, 8:10 AM
Is all the data returned in one request or are you loading each node level when it is expanded?

19 Mar 2012, 8:52 PM
For each node request is loading . By the way i am not calling each node, expandall() has the functionality

Is all the data returned in one request or are you loading each node level when it is expanded?

20 Mar 2012, 4:40 AM
Ok but if you expand each node and a request is sent to get it's children, when you execute expandAll it doesn't know about those new children whenever they come back.

22 Mar 2012, 5:50 AM
I have the same problem. We load whole tree in one request
1. ExpandAll with the toolbar button
2. Than collapseAll

23 Mar 2012, 9:06 AM
Hey Gang,

I'm experiencing a similar problem with treepanel nodes. The user can add folder nodes to the tree panel treepanel via a toolbar button. Nodes are added and the treepanel's depth adjust to each new node addition just fine. I was very pleased at this point.

But, if a user adds a node to the tree when the parent node is collapsed, the depth of the treepanel doesn't seem to recalculate properly and the tree get cropped-off (image provided).


So, before I append the parent node with another child node, I check if the selected-child is visible. If it isn't, then this childnode must reside in a collapsed parent node. Ok, so, if this is the case, I expand the parent node and then add the new child node. Unfortunately, I get the same results as I did if I didn't expand the parent first.

Here's a bit of code:

//get the node that's currently selected
var selModel = bpTree.getSelectionModel(); //treepanel selection manager
var node = selModel.getLastSelected();

//if node isn't visible, expand parent node before node addition




//do add node stuff here...


Adding an extreme height value to the tree initially works, but, this is a hack approach that I wish to avoid. Is there a way to remove collapse property for the tree?

Any ideas what gives here?


2 Jun 2017, 3:42 AM
I am also facing the same problem.
tree panel loaded in a request.

treePanel.expandAll(); //working fine.....
treePanel.collapseAll(); //not working

here is the stack trace.....

ext-all.js:22 Uncaught TypeError: Cannot read property 'insertBefore' of null
at F.doRemove (ext-all.js:22)
at F.onRemove (ext-all.js:22)
at F.fire (ext-all.js:22)
at F.doFireEvent (ext-all.js:22)
at F.a.doFireEvent (ext-all.js:22)
at F.fireEventArgs (ext-all.js:22)
at F.fireEvent (ext-all.js:22)
at F.onCollectionRemove (ext-all.js:22)
at F.notify (ext-all.js:22)
at F.splice (ext-all.js:22)

can anyone help me ?