the datasource for the ultragrid is SQL data rows. one of the columns "SortOrder" is int type in SQL.
when I click on the header of this column, it does the sorting, but it sorts the column treating the numbers as strings. The result is like 1 10 11 12 .....2 20 21...
How do I config the column setting to enable numeric sort?
Thank you,
Thanks Mike, as ever. You da man...
Hi,
The grid sorts by what the user sees. But you can change this using a SortComparer on the column that examines the Value of each cell and ignores the ValueList.
Or, an alternative would be to set the SortStyle on your ValueList to ValueListSortStyle.AscendingByValue or ValueListSortStyle.DescendingByValue. This will sort the items in the list and also let the grid know that the column should be sorted by value and not by the display text.
I seem to have this problem too. However, the underlying data is Integer, but I have a valuelist that converts the Integer value to String. When I sort, it still sorts the data by display value (string) rather than by underlying data value. Is there any way when I sort, it sorts by underlying value and not by display text?
If the data is being sorted as strings, then it must be string data in the grid. Your data source must somehow be converting the ints into strings for some reason.