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

[TableHeader] Can't unselect all when enableSelectAll={true} #3074

Closed
mbrookes opened this issue Jan 27, 2016 · 5 comments
Closed

[TableHeader] Can't unselect all when enableSelectAll={true} #3074

mbrookes opened this issue Jan 27, 2016 · 5 comments
Labels
bug 🐛 Something doesn't work component: table This is the name of the generic UI component, not the React module!

Comments

@mbrookes
Copy link
Member

When enableSelectAll is enabled, the TableHeader checkbox can be used to enable all rows, but doesn't disable all when clicked.

@mbrookes
Copy link
Member Author

Steps to reproduce:

  1. Go to the docs site: Components / Table / Complex example
  2. Turn on Multi-Selectable and Enable Select All
  3. Click the header checkbox (all items selected)
  4. Click it again. Nada.

@mbrookes mbrookes added the bug 🐛 Something doesn't work label Jan 31, 2016
@scottsilvi
Copy link

FYI, I've been diving into area of code as a result of an unrelated issue. What I've discovered is, if I remove the following code inside of table-body.jsx > componentWillReceiveProps, this behavior is no longer broken.

if (this.props.allRowsSelected && !nextProps.allRowsSelected) {
  newState.selectedRows = this.state.selectedRows.length > 0
    ? [this.state.selectedRows[this.state.selectedRows.length - 1]]
    : [];
} else {
  newState.selectedRows = this._calculatePreselectedRows(nextProps);
}

New to MUI (and react) so I don't necessarily have the context required to know how to fix this, or any 2nd or 3rd order effects, quite yet.

[EDIT TO ADD]
Happy to fix & submit PR if somebody with the requisite context can provide some high-level detail on what this is doing, why it's doing it, etc
[/EDIT]

@vasyas
Copy link

vasyas commented Oct 18, 2016

Hit the same issue. Any plans on fixing it?

@lucasbento lucasbento added the component: table This is the name of the generic UI component, not the React module! label Oct 18, 2016
@bedrich-schindler
Copy link

I have the same problem. I am unable to unselect all rows using main checkbox in header.

@mbrookes
Copy link
Member Author

Sorry this never got fixed.

Table has already been migrated to (and of I'm not mistaken completely rewritten for) next and so should be resolved there, so I'm closing this for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: table This is the name of the generic UI component, not the React module!
Projects
None yet
Development

No branches or pull requests

5 participants