I've noticed when I sort a column with numeric values it does not seem to sort correctly. For example I have a column with the following numbers: 565, 5786, 6335, 6351, 61447. When I sort the column (DESC) the numbers are ordered as follows:
The problem seems to be in sorting numbers vs. text.
For reference I am using "angular-ui-grid": "~3.1.1"
Try giving column type as "number" for this. The sort algorithm is chosen based on the column type. ui-grid will guess the type based on the data, although if you load data asynchronously after the columns it will often decide all your columns are string. You can explicitly set the column type in the column def using type:'number'.
More details here
Just add a type: 'number' to the column definition -columnDefs- in your js file. it will work well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With