Skip to content

selectAll is selecting child rows that are not selectable #6370

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

Closed
jgunderson-IAS opened this issue Aug 22, 2017 · 0 comments · Fixed by #6627
Closed

selectAll is selecting child rows that are not selectable #6370

jgunderson-IAS opened this issue Aug 22, 2017 · 0 comments · Fixed by #6627

Comments

@jgunderson-IAS
Copy link

jgunderson-IAS commented Aug 22, 2017

When using the selectAll button uiGrid will select ALL child rows, even child rows that are specifically set to not be selectable as long as they are in a collapsed state. If you expand a row to show the children and then click the selectAll button the child rows that are visible will not get selected as expected but the hidden children still get selected. If you hit the expandAll button in the plnkr so all rows are expanded and then click the selectAll button you will get the proper number of selected rows(4).

I put a counter at the bottom of the plnkr showing the number of selected rows to help visualize the issue.

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

I work around this issue by watching the batch change and manually running the isRowSelectable method on every row which should be happening by default:

$scope.gridApi.selection.on.rowSelectionChangedBatch($scope, function(rows) {
    rows.forEach(function(row) {
        row.isSelected = row.isSelected && $scope.gridApi.grid.options.isRowSelectable(row);
    });
});

Working plnkr with my work around:
http://plnkr.co/edit/s4GMK6JbCZTUEk3SdPoq?p=preview

mportuga pushed a commit that referenced this issue Mar 22, 2018
…ion.

Added a check to verify if rows are selectable prior to selecting them.

fix #6370
mportuga pushed a commit that referenced this issue Mar 22, 2018
…ion.

Added a check to verify if rows are selectable prior to selecting them.

fix #6370
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants