I'm submitting a ...
[x ] bug report
[ ] feature request
[ ] support request
Current behavior
Currently (after updating from v8 to version v12) sorting rows by string values is by default case-sensitive, so a column with values: "a", "B", and "c", will be sorted as:
Expected behavior
I'm not sure what the specified behavior is, but in version 8 the default string sort was case insensitive, resulting in the following order:
What is the motivation / use case for changing the behavior?
The default sorting behavior seems to have changed. Since I could not find anything about this in the release notes* I thought this might have happened unintentionally.
The change seems to be introduced in this commit, where the default localeCompare is replaced with a doQuickCompare function.
Or should the 'accentedSort' be used for case insensitive sort? In which case it would be nice to have this mentioned in the documentation.
* I updated from 8 to 12, so I had to go through quit some release notes and might have missed this.
Please tell us about your environment:
ag-Grid version: 12.0.1
Browser:
All
this was done on purpose, to allow for quicker comparing when you don't get impacted by case.
to have it work as previous, attach your own 'default' comparator to the default col def, ie:
gridOptions = {
defaultColDef = {
comparator: function(a,b) {
if (typeof a === 'string') {
return a.localCompare(b);
} else {
return (a > b ? 1 : (a < b ? -1 : 0));
}
}
}
...
}
The snippet from @ceolter above contains a typo ( localCompare -> localeCompare).
gridOptions = {
defaultColDef = {
comparator: function(a,b) {
if (typeof a === 'string') {
return a.localeCompare(b);
} else {
return (a > b ? 1 : (a < b ? -1 : 0));
}
}
}
...
}
GridOptions now has a property accentedSort for this.
Most helpful comment
The snippet from @ceolter above contains a typo (
localCompare -> localeCompare).