Sort Treegrid

Hi,

I have a treegrid with one treelevel. Is it possible to sort only the rows of level 2 and leave the sort of L1 (the treelevel) unsorted (like you can to with filtering)?

Unfortunately, it is not possible, sorting will be applied for all levels in a treegrid.

You can define your own sorting function, which will ignore items on the top level, combined with enableStableSorting call it may provide you the necessary result.

Is an example available how to do?

Greetings

P.S. And by the way (please don´t be angry) this a good example for the on line help
-> enableStableSorting - docu: enables stable sorting algorithm
great - what is stable sorting???

Your product is one the best I ever see - but the docu most often is for waste. I know documentation job is a nightmare and I also don´t want to do it for my product. But i saves a lot of time in end user support :slight_smile:

The stable sorting is a sorting by multiply columns.
In this case the rows with the same values will not change their positions, and it will help to organize sorting by multiple columns:

grid.enableStableSorting(true);
grid.sortRows(1,“str”,“asc”); // sort by the sibling column
grid.sortRows(0,“str”,“des”); // sort by the main column

As a result, the grid will be sorted by a column of less importance and after that - by a column of higher importance. In combination with stable sorting it will give the same result as sorting by two columns.