PDA

View Full Version : [CLOSED] Sorting Treestore



elbanna23
Nov 20, 2014, 6:45 AM
Dear All
How can I sort treestore that load from xmldatasource

Daniil
Nov 20, 2014, 8:01 AM
Hi @elbanna23,

You could try with a TreeStore's Sorters.

<ext:TreeStore runat="server" ...>
<Sorters>
<ext:DataSorter Property="text" Direction="ASC" />
</Sorters>
</ext:TreeStore>

elbanna23
Nov 20, 2014, 8:28 AM
Thanks Daniil , it's work fine for me.

how can i make sorting for specific level of nodes ?

root
--- level1
-------level2
----- child1
----- child3
----- child2

for example if i want to make sorting just for the children to level2 ?

many thanks in advance

Daniil
Nov 20, 2014, 8:34 AM
A TreeStore's Sorters doesn't support sorting of specific nodes only.

You can sort it in JavaScript via a node's sort method.
http://docs-origin.sencha.com/extjs/5.0/apidocs/#!/api/Ext.data.NodeInterface-method-sort

Another approach could be preparing the data on server before binding to a TreeStore.

elbanna23
Nov 20, 2014, 8:53 AM
Many thanks Daniil , you can close the thread now.