最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - react-table load detail data when row is expanded - Stack Overflow

programmeradmin4浏览0评论

The react-table ponent is really cool and getting the data in is a breeze.

But when I try to get a detail ponent to load when a row is expanded it seems to confuse the row code. I've tried to use the ponentWillMount 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?

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

But when I try to get a detail ponent to load when a row is expanded it seems to confuse the row code. I've tried to use the ponentWillMount 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?

Share Improve this question asked Aug 15, 2017 at 19:12 MichaudMichaud 1,1068 silver badges12 bronze badges 2
  • What do you want to achieve? Have you looked into this example: react-table.js/#/story/sub-ponents ? – An Nguyen Commented 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 subponent. I made the subponent an actual react ponent. What I want to achieve is: show data in table > expand row > load more data , show it in the expanded row. – Michaud Commented Aug 15, 2017 at 22:11
Add a ment  | 

1 Answer 1

Reset to default 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}
发布评论

评论列表(0)

  1. 暂无评论