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

onRowSelectChange and onRowSelectAllChange not being fired #1

Closed
cyberdevnet opened this issue Mar 18, 2022 · 7 comments
Closed

onRowSelectChange and onRowSelectAllChange not being fired #1

cyberdevnet opened this issue Mar 18, 2022 · 7 comments
Assignees

Comments

@cyberdevnet
Copy link

using the example at https://www.material-react-table.dev/?path=/story/features-selection-examples--on-row-select-change

Onchange events of the checkboxes are not fired:

<MaterialReactTable
columns={columns}
data={data}
enableSelection
onRowSelectChange={(event, rowState, selectedRows) => {
console.log({ event, rowState, selectedRows });
}}
/>

@KevinVandy
Copy link
Owner

I didn't even realize that none of that code was being triggered. Thanks. Will be fixed in the next update today, though there are a bunch of unstable issues with the select feature in general that still need to be developed.

Congrats on being this repos first issue. I'm curious to learn how dozens of people have suddenly found my (still in alpha) project in the past week.

Join the discord if you are curious about the roadmap for this project as I develop it!

@KevinVandy KevinVandy self-assigned this Mar 19, 2022
@KevinVandy
Copy link
Owner

all I needed to do was swap the order of the props

        <Checkbox
          inputProps={{
            'aria-label': selectAll
              ? localization.toggleSelectAll
              : localization.toggleSelectRow,
          }}
          {...checkboxProps}
          onChange={onSelectChange}
          title={undefined}
        />

@KevinVandy
Copy link
Owner

This should now be resolved as of version 0.6.9. However, note that the onRowSelectChange prop name was changed to onSelectChange

@domi-glyph
Copy link

domi-glyph commented Feb 14, 2023

Is this now changed to onRowSelectionChange? how do I obtain the selected rows data? I need to keep the data in redux store and pass it to state so it would keep the selected rows.

@KevinVandy
Copy link
Owner

@domi-glyph This prop no longer exists in MRT.

But the docs are very clear on how to manage the row selection state: https://www.material-react-table.com/docs/guides/row-selection#access-row-selection-state

And in general, how to either manage all of the state you need (like to store in redux or whatever): https://www.material-react-table.com/docs/guides/table-state-management#manage-individual-states-as-needed

@domi-glyph
Copy link

@domi-glyph This prop no longer exists in MRT.

But the docs are very clear on how to manage the row selection state: https://www.material-react-table.com/docs/guides/row-selection#access-row-selection-state

And in general, how to either manage all of the state you need (like to store in redux or whatever): https://www.material-react-table.com/docs/guides/table-state-management#manage-individual-states-as-needed

this works, thanks!

@MumarAslam
Copy link

MumarAslam commented Sep 26, 2023

@KevinVandy onRowSelectionChange is not being fired for me as i am following the
https://www.material-react-table.com/docs/guides/row-selection#access-row-selection-state

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

4 participants