简体   繁体   English

行扩展时的反应表加载详细数据

[英]react-table load detail data when row is expanded

The react-table https://react-table.js.org component is really cool and getting the data in is a breeze. react-table https://react-table.js.org组件确实很酷,并且轻松获取数据。

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. 我试过使用componentWillMount或React Component类的update函数,但是当我展开行时,它再次折叠。

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. 我正在使用axios从服务器获取数据,将其馈入redux状态并将其添加到行数据中,但是当redux状态中的数据更新时,表中的行数据似乎没有更新。

Does react-table support this use-case? 反应表是否支持该用例?

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}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM