PDA

View Full Version : TreePanel sorting with hidden root node



hyankov
25 May 2007, 10:32 AM
Hi guys.

I have a TreePanel initiated like this:

var tree = new Ext.tree.TreePanel(el, {rootVisible: false});

This of course means that my root node is hidden. After loading the data in the tree (HttpProxy) I try to to sort it using this code:

var sorter = new Ext.tree.TreeSorter(this, {folderSort:true});

My tree has this structure:
Root (hidden)
|
|____ Parent 2
|____ Parent 1
| |__ Child 1
| |__ Child 2
| |__ Child 3
|
|____ Parent 3

It works perfectly for the child nodes, but the 'Parent' nodes are not sorted, because they don't have visible parent.

Any idea how to resolve this? Thanks!

hyankov
25 May 2007, 4:09 PM
Nobody knows? =D>

hyankov
29 May 2007, 8:42 AM
In case someone needs it - here is how I resolved the problem:

var sorter = new Ext.tree.TreeSorter(tree, {folderSort:true});
sorter.doSort(tree.getRootNode());

Without the second line, it is not going to sort the 1st level children of the tree, if the root node is not visible.