-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Table: Row selection is not cleaned up when table data is removed. #5850
Comments
We already have the The reason we don't want the table to clear row selection of row ids that are no longer present in the table is that there are many reasons that rows will disappear from the table, but you'd still want them to stay selected. Manual server-side pagination being the most common. It would definitely upset a lot of people if every time a user paginated to a new page, the row selection state disappeared just because that particular row is not present in the What kind of API do you propose besides |
Here is my current logic and I feel like it's very very verbose. I know what records were removed and so I just want to clear selection if they are there, and I want it to happen smartly (no redraw if not in selection). You already know the id function so passing id's or even objects makes sense to me.
What I basically want to do is just say table.removeRowSelection([id1, id2]) and or by single id (table.removeRowSelection(id1). Also, side note: a huge portion of real-world apps are spa apps and I have no intention to ever use RCS. My backend is ASP.NET Core. |
By "server-side", we're not talking about RSC or even SSR. We're just talking about 'manual' data transfermations like doing pagination, sorting, or filtering outside of the TanStack Table client-side logic. Like using the As for a new API, I guess it could be helpful, but I don't see that much of a need for it. How about we add it to the v9 alpha branch where more APIs with a larger bundle size footprint are going to matter a lot less? |
Thanks for the clarification. I am using
The more that I think about this, feels like having helpers to remove selection by id would be easiest like table.removeSelectionById similar to |
TanStack Table version
8.20.6
Framework/Library version
latest
Describe the bug and the steps to reproduce it
I'd expect some easy api's to remove selection by id and or some guidelines ho to maintain state when you know data is being removed. In my case I have web sockets that tell me data is being removed, and I want to ensure selection is in a good state (as I'm doing complex things like skipping refresh if there is a selection).
I modified the same here: https://tanstack.com/table/latest/docs/framework/react/examples/row-selection Just paste in this code, make a selection and then hit refresh data.
Your Minimal, Reproducible Example - (Sandbox Highly Recommended)
https://tanstack.com/table/latest/docs/framework/react/examples/row-selection
Screenshots or Videos (Optional)
No response
Do you intend to try to help solve this bug with your own PR?
None
Terms & Code of Conduct
The text was updated successfully, but these errors were encountered: