Page 1 of 1

Problems with sorting in Multicolumn list :?:

Posted: Wed Jun 28, 2006 13:42
by toma21207
I have problem when sorting column that is filled only with numbers, for example the number 11 is befoure number 2. Or some example of sorting:
11, 12, 13, 1, 20, 21, 22, 2....

I have solution, but I don't wont to do that way, if I write numbers like 01 ,02, 03... than it's work, but I need numbers in format 1, 2, 3....

Plese help... :shock:

Posted: Thu Jun 29, 2006 05:56
by Dalfy
There is no way to define your own sort function at the moment. It use a string sort and thus the only solution is to use 01, 02, ...

There's no way to do it even in 0.5.0 RC1.

Problems with sorting in Multicolumn list

Posted: Fri Jun 30, 2006 14:26
by Chocapic
We modified CEGUI's source code to achieve this.
One way to do it easily is to store not only the text but also a numeric value in the item and adapt sorting to use this number instead of the text when the user specifies that the item is numeric.
This solution also work for dates and other types of values where text is not suitable for sorting.

Posted: Sat Jul 01, 2006 11:17
by Dalfy
Setting the comparator object used to do the sorting per column seems another good solution. It might be one of 0.6 addition ;)