React Virtualized - onclick, expand Rows for additional details

给你一囗甜甜゛ 提交于 2019-12-10 01:12:00

问题


I have a requirement to open/close additional row details.

Has anyone implemented or have ideas on how to go about implementing expand/collapse feature for each row?


回答1:


There's a template of sorts for this sort of thing (demo, source) The important bit is that you'll need to tell your List/Grid/whatever when an open/close has changed (aka when size might have changed), eg:

this._listRef.recomputeRowHeights(indexOfChangedRow) // Clear cached size
this._listRef.forceUpdateGrid() // Rerender list with new size



回答2:


For what it's worth ... :-)

CodeSandbox sample




回答3:


I was looking for the same feature, but I did not find some useful results as I searched, maybe this sandbox helps others looking for a similar feature in their apps:

The example is using Table from react-virtualized beside react hooks.

Example



来源:https://stackoverflow.com/questions/41105564/react-virtualized-onclick-expand-rows-for-additional-details

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!