4

The react-table https://react-table.js.org component is really cool and getting the data in is a breeze.

But when I try to get a detail component to load when a row is expanded it seems to confuse the row code. I've tried to use the componentWillMount or update functions of the React Component class but when I expand the row it collapses again.

I'm using axios to fetch the data from a server , feed it into the redux state and add it to the row data but the row data in the table doesn't seem to update when the data in the redux state updates.

Does react-table support this use-case?

2
  • What do you want to achieve? Have you looked into this example: react-table.js.org/#/story/sub-components ?
    – An Nguyen
    Aug 15, 2017 at 19:15
  • yes, I did look at the example, but that uses the one data set for the table and the subcomponent. I made the subcomponent an actual react component. What I want to achieve is: show data in table > expand row > load more data , show it in the expanded row.
    – Michaud
    Aug 15, 2017 at 22:11

1 Answer 1

7

I've had the same problem. So far, I managed to stop the expanded row from collapsing by adding this property to the main table

freezeWhenExpanded={true}
1
  • This worked in my situation, and even maintained the expanded row while the data was being asynchronously updated! Feb 8, 2018 at 6:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.