You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've read #590 but don't really understand the outcome. However, at some point in that discussion, I think @jbetancur asked what the use case is. My use case is this: I have this kind of crazy but very useful nested data table:
Because of the nesting, sorting has to be done at each indent level, and I do that through my initial sorting of the data and I set sortable: false on all columns. However, sometimes the user does want to sort, so I allow them to turn nesting off and then the columns toggle to sortable: true. But when they turn nesting back on, the table stays sorted, which means the nesting makes no sense:
I would just like to tell the table to go back to it's initial state. I tried forcing a rerender by replacing data with a copy ([...data]), but that's not doing anything.
In writing this issue, I did figure out a klunky workaround: in my event handler for toggling nesting back on, window.location.reload().
So, maybe I misunderstood and there's already a way to do this without that workaround, or maybe this use case is argument enough for implementing a reset feature, but, with the workaround, it's not a dire situation for me.
Thanks for the component! It's helped me a lot over the years.
The text was updated successfully, but these errors were encountered:
…f43-bb59-5c48d56fe497)
- Now have a toggle button for switching between nested and unnested. The only way I could figure out to get the original sort order back after going back to nested is by reloading the whole page. A bit clunky, but it works.
- I did open an issue jbetancur/react-data-table-component#1260 to see if react-data-table-component can provide a way to do this without a reload, but not super important.
- Fixes#929 and #506
I've read #590 but don't really understand the outcome. However, at some point in that discussion, I think @jbetancur asked what the use case is. My use case is this: I have this kind of crazy but very useful nested data table:
![image](https://private-user-images.githubusercontent.com/1586931/386344983-c3e3678a-cbbd-4495-8cd5-4b3debf2ddfe.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk0MzU5NDEsIm5iZiI6MTczOTQzNTY0MSwicGF0aCI6Ii8xNTg2OTMxLzM4NjM0NDk4My1jM2UzNjc4YS1jYmJkLTQ0OTUtOGNkNS00YjNkZWJmMmRkZmUucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxMyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTNUMDgzNDAxWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9Yzk1ZDI5ODdmMTdjODA4YmU5NGQyZjU1ZjU1Zjc2ZjA5ZTQ0N2FiYzYzMjllMDZmNzBiNzE5OWQ0OTU4NTAzYyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.NzdGhhUvgwtF5v5nc6SqXGIqdPoPuMmvMhz_8e7madY)
Because of the nesting, sorting has to be done at each indent level, and I do that through my initial sorting of the data and I set sortable: false on all columns. However, sometimes the user does want to sort, so I allow them to turn nesting off and then the columns toggle to sortable: true. But when they turn nesting back on, the table stays sorted, which means the nesting makes no sense:
![image](https://private-user-images.githubusercontent.com/1586931/386345926-a891ee9f-a8a0-43ae-9bd2-9418dd161dde.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk0MzU5NDEsIm5iZiI6MTczOTQzNTY0MSwicGF0aCI6Ii8xNTg2OTMxLzM4NjM0NTkyNi1hODkxZWU5Zi1hOGEwLTQzYWUtOWJkMi05NDE4ZGQxNjFkZGUucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxMyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTNUMDgzNDAxWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ODlhMDg3MTQ0NzNlM2M3NTFhMjI0N2QxYjBiOTdiZDAyNTY1Y2Y3YWMwNTg4N2RhMDMxMWJhYjhhN2NlNjM2MiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.4Jto3cZ1iaIA36SbPVYKr8s5d8Dywk5WfQEQKtbRgrw)
I would just like to tell the table to go back to it's initial state. I tried forcing a rerender by replacing data with a copy (
[...data]
), but that's not doing anything.In writing this issue, I did figure out a klunky workaround: in my event handler for toggling nesting back on,
window.location.reload()
.So, maybe I misunderstood and there's already a way to do this without that workaround, or maybe this use case is argument enough for implementing a reset feature, but, with the workaround, it's not a dire situation for me.
Thanks for the component! It's helped me a lot over the years.
The text was updated successfully, but these errors were encountered: