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

bulk selection needs to add all row indexes to the selection store #145

Closed
headwinds opened this issue Mar 25, 2017 · 2 comments
Closed
Assignees
Labels

Comments

@headwinds
Copy link
Contributor

headwinds commented Mar 25, 2017

If you click the bulk check box, all the rows are visually selected but the indexes array is not available like it is when you check the rows individually.

const indexes = this.props.selection.get("myGrid").get("indexes");

indexes should be defined as an array with all the row indexes after clicking the bulk checkbox.

For instance, in a grid with 10 rows. If you begin with a bulk check then manually uncheck a row, you should now have 9 indexes but indexes is undefined. If you check that same row again, indexes is now defined but with 1 not 10.

@bencripps I'm going to try to fix this and update the tests. I just wanted to capture it. Please assign it to me.

@headwinds
Copy link
Contributor Author

headwinds commented Mar 25, 2017

the workaround is not use to indexes - instead the selected state of each row which is actually included within selection although its not reflected in indexes.

const selection = this.props.selection.get("workbench");
const selectionData = selection.toJS(); 
const selectedIds = [];
for (var key in selectionData) {
  if (selectionData[key]) {
    let selectedId = key.split("row-")[1];
    if ("NaN" !== String(Number(selectedId))) selectedIds.push(Number(selectedId));
  }
}

selectionData looks like:

{
indexes: Array[0],
lastUpdate: 6,
row-0: true,
row-1: false,
row-2: true,
row-3: true
}

@bencripps
Copy link
Owner

This was resolved with #160

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

No branches or pull requests

2 participants