gregnb / gregnb/mui-datatables
onRowSelectionChange disables SelectToolbar
- Dominant language
- JavaScript
- Stars
- 2.7k
- Forks
- 906
- PR merge metrics
- No merged PRs in 30d
Description
When implementing `onRowSelectionChange` (which according to docs should return `void`) 3 things happen:
- select works for just one row, and only for select (and not deselect)
- select button doesn't change (no V state)
- `SelectToolbar` doesn't appear (no matter the `selectToolbarPlacement` value)
## Expected Behavior
`onRowSelectionChange` should only be a listener to selection function, and I suspect it's deeper (haven't explored the internals).
That way, we can encapsulate the selection change with different implementations (basic example: state controlling whether or not there are any selected rows), without affecting the selection behavior itself.
## Current Behavior
Seems like `onRowSelectionChange` either controls the selection behavior and we override it, or it should return something that isn't documented.
## Steps to Reproduce (for bugs)
Just implement `onRowSelectionChange` and you'll see.
Edited the official example for `CustomToolbar` to showcase the behavior:
https://codesandbox.io/s/festive-chebyshev-til1i?file=/examples/customize-toolbar/index.js
## Your Environment
Used the official Examples CodeSandbox, so I'm assuming those are the most relevant versions.
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the issue using the official CustomToolbar example at examples/customize-toolbar/index.js and the linked CodeSandbox, with onRowSelectionChange enabled. Trace how that callback affects row selection and SelectToolbar rendering, then verify that selection, deselection, the selected-state indicator, and SelectToolbar still work while the callback remains a listener.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100