Skip to content
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

selectAllRows() method raises rowSelectionChangedBatch prior to setting the selectAll flag #5411

Closed
NuNn-DaDdY opened this issue May 18, 2016 · 0 comments · Fixed by #6693
Closed
Assignees

Comments

@NuNn-DaDdY
Copy link

NuNn-DaDdY commented May 18, 2016

It appears that the selectAllRows method is raising rowSelectionChangedBatch prior to setting the selection.selectAll flag. Due to this, you're unable to determine if all rows were selected via getSelectAllState().

selectAllRows

service.decideRaiseSelectionBatchEvent(grid, changedRows, evt);
grid.selection.selectAll = true;

However, this doesn't appear to be the case with the service.toggleRowSelection function that's called when a single row has been selected.

toggleRowSelection

selectedRows = service.getSelectedRows(grid);
grid.selection.selectAll = grid.rows.length === selectedRows.length;
grid.api.selection.raise.rowSelectionChanged(row, evt);

From looking at the code a bit more, it's actually the selectAllVisibleRows method that get's called when the select all checkbox is clicked and this appears to have the same issue as selectAllRows.

selectAllVisibleRows

service.decideRaiseSelectionBatchEvent( grid, changedRows, evt );
grid.selection.selectAll = true;

After updating a forked copy of the code, I noticed that the clearSelectedRows method is invoking the decideRaiseSelectionBatchEvent prior to setting the selectAll and causes getSelectAllState to return true when it should be false inside rowSelectionChangedBatch

clearSelectedRows

service.decideRaiseSelectionBatchEvent( grid, changedRows, evt );
grid.selection.selectAll = false;
grid.selection.selectedCount = 0;

@mportuga mportuga self-assigned this Apr 21, 2018
mportuga pushed a commit that referenced this issue Apr 24, 2018
…ctAll flag.

Change order of toggle to match toggleRowSelection function

fix #5411
mportuga pushed a commit that referenced this issue Apr 24, 2018
…ctAll flag.

Change order of toggle to match toggleRowSelection function

fix #5411
m4m4m4 pushed a commit to m4m4m4/ui-grid that referenced this issue Apr 24, 2018
…ctAll flag.

Change order of toggle to match toggleRowSelection function

fix angular-ui#5411
defields923 pushed a commit to defields923/ui-grid that referenced this issue Oct 30, 2018
…ctAll flag.

Change order of toggle to match toggleRowSelection function

fix angular-ui#5411
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