reactdatagrid icon indicating copy to clipboard operation
reactdatagrid copied to clipboard

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

Open francis-vila opened this issue 1 year ago • 2 comments

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

francis-vila avatar Apr 12 '24 15:04 francis-vila

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

LeadDreamer avatar Apr 17 '24 17:04 LeadDreamer

Silly me... Thanks for answering anyway.

francis-vila avatar Apr 18 '24 07:04 francis-vila