inovua / reactdatagrid

Empower Your Data with the best React Data Grid there is
https://reactdatagrid.io
Other
3.45k stars 57 forks source link

number column in some group conditions sorts by first digit, not by number #417

Open francis-vila opened 2 months ago

francis-vila commented 2 months ago

When using grouped columns, in some combinations sorting numbers arranges them sorted by digit 'alphabetical' order, for example for an upward sort 11111, then 22, then 333, then 4444444, etc.

More specifically, it's when other columns are grouped and one column is not part of any group.

Open this sandbox and click on the last column CCCCC to see the effect:
https://codesandbox.io/p/sandbox/reactdatatable-issue-g9hd42?file=%2Fsrc%2FApp.js%3A377%2C51

Note that if you add

group: "other",

to line 395, the sort works as expected

LeadDreamer commented 2 months ago

your column "CCCCC" is not declared as type: "number" - so it defaults to a lexical sort. Tested using your codesandbox.

francis-vila commented 2 months ago

Silly me... Thanks for answering anyway.