-
-
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
Subcomponent refers to different row value when the data changes/re-sorts #48
Comments
Let's talk though some of this:
Let me know what you think |
Wow thanks for the quick response.
Actually, I just thought of a way around this- if I could programmatically set which column to sort by, I could set the table to sort by a hidden, empty column to prevent the table from sorting. Getting the table to sort again would be as simple as letting it sort by any other visible column |
I like your approach to the sorting. Remember that you can control the sorting model directly by passing |
If you would like to submit a PR to close the expanded rows on data change, I would merge or for you. |
ok cool, I think I got the gist of it. I got I'm running into a very strange problem though- when I set the state's sortArray to different values, the ReactTable's classes all update with the correct ascending and descending styles, but the table doesn't actually sort (I think it doesn't trigger a re-render) until I either expand a column or click on the column to re-sort again, then it'll actually trigger the sorting re-render. I got around this in a very hacky way by setting
But nothing else really works... this is inelegant but it does. Do you have any ideas why this is happening? Sure, I can add a |
I would just default the As for the strange behavior, I think we just need to make sure that we are firing off the sorting method when and if the sorting props change. |
Fixed with the options provided in 1e4f838 |
Let's say I have opened the third row's subcomponent.
When a row's data changes and causes the table to re-sort, the opened component will re-render with the information from the new data that's in the third row. (this causes all the data to change in the subcomponent when the row re-sorts, which is kind of annoying)
If the data is changing a lot, then a user will have to keep closing and reopening. Is there any way to turn off auto-sorting so sorting only happens when a user clicks on a column header, and doesn't auto sort otherwise? (sortable=false seems to do this only initially- when a user clicks on a column header the row starts to sort automatically on data refresh)
The text was updated successfully, but these errors were encountered: