material-table icon indicating copy to clipboard operation
material-table copied to clipboard

Rows selection not working with redux

Open bbouabou opened this issue 7 years ago • 4 comments

Describe the bug If I dispatch an action inside the onSelectionChange the selection of rows doesn't work.

To Reproduce Steps to reproduce the behavior: Try to check a line: https://codesandbox.io/s/material-table-with-redux-h3yyx

Expected behavior The checkbox should be checked

bbouabou avatar Aug 26 '19 11:08 bbouabou

I am getting the same behaviour on a normal table without redux

Example: https://codesandbox.io/s/material-table-selection-ji7go

lasimonne avatar Sep 05 '19 12:09 lasimonne

@bbouabou I faced same problem. This is because the way react works. When state changes, your component updates itself. So, I changed your code a little bit. Now it works as expected. Here is the code: https://codesandbox.io/s/material-table-with-redux-0zcom

faysal-ishtiaq avatar Sep 20 '19 14:09 faysal-ishtiaq

Push https://codesandbox.io/s/material-table-selection-ji7go

As soon as state is updated by the selection the whole selection is being reset. This is really annoying.

An Idea would be to introduce a table prop which lets us control the selection state. In my point of view this is a missing feature anyway, since there is no way at the moment to select rows programmatically.

SMenigat avatar Jan 15 '20 11:01 SMenigat

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You can reopen it if it required.

stale[bot] avatar Jun 30 '20 22:06 stale[bot]