Sort certain part of a Tree store

45 Views Asked by At

I have a tree panel. And I want to sort treeStore in 'ASC' by field 'size'. I tried to achieve this like :

TreeStore.sort(property: 'size', direction: 'ASC')

But I want to sort store from the fifth record onward. And first 5 records should remain as it is(unaffected from sorting).Can someone guide me that how I can achieve this?

1

There are 1 best solutions below

0
Alexander On BEST ANSWER

This is not supported out of the box, so you would have to pass a special marker to the four records that you wish to keep at the top, e.g.

mark: "1"
mark: "2"
mark: "3"
mark: "4"
mark: "5+"
mark: "5+"
mark: "5+"
mark: "5+"

and then sort by that marker first:

TreeStore.sort([{property:'mark',direction:'ASC'},{property: 'size', direction: 'ASC'}]);