Skip to content

Sorting grouped columns fails in chrome #4778

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
robertaandersen opened this issue Nov 27, 2015 · 4 comments
Open

Sorting grouped columns fails in chrome #4778

robertaandersen opened this issue Nov 27, 2015 · 4 comments

Comments

@robertaandersen
Copy link

When sorting grouped columns where row-count exceeds 9 the sorting fails. The data in the column is an integer. Strings work.

http://plnkr.co/edit/yqLPx1bu40ainD1VT9Bw?p=preview

Thanks
Róbert

@robertaandersen
Copy link
Author

This is bound to chrome

@a002194
Copy link

a002194 commented Mar 21, 2016

We facing the same issues in chrome, Custom Sorting Algorithm with Grouping is creating duplicate records in Grid.

grouping: {
groupPriority: 0
},
sort: {
direction: uiGridConstants.DESC,
priority: 0,
},
sortingAlgorithm: function (a, b, rowA, rowB, direction) {
var nulls = $scope.gridApi.core.sortHandleNulls(a, b);
if (nulls !== null) {
return nulls;
}
else {
if (a === b) {
return 0;
}
if (a.indexOf('New') != -1) {
return 1;
}
if (b.indexOf('New') != -1) {
return -1;
}
if (a.indexOf('On-Hold') != -1) {
return 1;
}
if (b.indexOf('On-Hold') != -1) {
return -1;
}
if (a.indexOf('In-Progress') != -1) {
return 1;
}
if (b.indexOf('In-Progress') != -1) {
return -1;
}
if (a.indexOf('In-Queue') != -1) {
return 1;
}
if (b.indexOf('In-Queue') != -1) {
return -1;
}
if (a.indexOf('In-Review') != -1) {
return 1;
}
if (b.indexOf('In-Review') != -1) {
return -1;
}
return 0;
}
}

@brafkind
Copy link

This is due to the fact that the group header rows are strings by default. Note the comment on groupingShowCounts under GridOptions ui.grid.grouping

shows counts on the groupHeader rows. Not that if you are using a cellFilter or a sortingAlgorithm which relies on a specific format or data type, showing counts may cause that to break, since the group header rows will always be a string with groupingShowCounts enabled.
Defaults to true except on columns of type 'date'

Disabling groupingShowCounts fixes the issue although it also hides the counts at the group level. Link to Plunkr

@murlinw
Copy link

murlinw commented Aug 22, 2016

For anyone that wants a resolution in chrome, what I've done is create a custom sorting function that sorts by looking only at the number. It'll split out between the parenthesis and the actual number and then sort the actual number.

Here's an example of the custom sort that I've done.
http://plnkr.co/edit/dvFcz1PCIXXcZP3tdcpR

farooqu pushed a commit to GenesysPureConnect/ng-grid that referenced this issue Oct 26, 2016
Add mousedown listener to ui.grid.edit.directive:uiGridEditor to disable
blur handler if the element is a checkbox, and then re-focus the
checkbox and enable the blur handler after a $timeout. This change is to
deal with Safari and Firefox behavior in macOS where clicking the
checkbox causes a blur event, and the value is not updated.

GitHub issues: angular-ui#1785, angular-ui#4778, angular-ui#4782
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants