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

Grid does not update select all state when data changes. #6033

Closed
wholladay opened this issue Feb 22, 2017 · 2 comments
Closed

Grid does not update select all state when data changes. #6033

wholladay opened this issue Feb 22, 2017 · 2 comments

Comments

@wholladay
Copy link

I have a ui-grid with multi-select enabled. Everything works fine, except when the data changes, the "select" column in the header does not properly show the state of the grid. I've created a simple example in plunker that illustrates the issue. To reproduce:

  1. Click on the "select" header element. Notice that all the rows are selected as they should be.
  2. Click on the "Add Data" button. Notice that the new row is not selected, but the header is still showing a check mark as if all the rows are currently selected.

If you click on any of the rows at this point, the code is smart enough to properly set the header check value. It seems to me that as the data for the grid changes, the status of the "all selected" flag should be re-evaluated.

This sample code was created by forking the "112 Add/Delete/Swap Data" tutorial code and just adding multi-select to the grid.

@rescru
Copy link

rescru commented Feb 23, 2017

Just had a brief look at the code and it seems the selection module is not listening for any changes in the underlying data. Therefore once the new row is added the selection model is outdated until a new selection takes place.

I have just recently started using this grid and its awesome!!

I will look to see if there is an event that can be listened to and then the selection model will need to listen to it.

Very keen to contribute a fix as I have found this grid extremely useful. I am however a bit of a newbie and not sure of the process to follow.

Anyone can point me in the right direction?

wholladay pushed a commit to wholladay/ui-grid that referenced this issue Feb 27, 2017
…ctAll" header check is not in sync with the actual selection state of the row. Perhaps this is not the best solution because it couples the selection directive the ui-grid directive. However, this does illustrate a possible solution.
@wholladay
Copy link
Author

I created a pull-request with a possible solution to this issue.

mportuga pushed a commit that referenced this issue Aug 11, 2017
…der check is not in sync with the actual selection state of the row. Perhaps this is not the best solution because it couples the selection directive the ui-grid directive. However, this does illustrate a possible solution.
vishalnarewade pushed a commit to vishalnarewade/ui-grid that referenced this issue Nov 6, 2017
…ctAll" header check is not in sync with the actual selection state of the row. Perhaps this is not the best solution because it couples the selection directive the ui-grid directive. However, this does illustrate a possible solution.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants