反应表V7-检测扩展更改

问题描述 投票:0回答:1

[在React-table V6中,我们有一个道具-onExpandedChange,我们可以传递一个在更改扩展后将执行的函数,如何在react-table V7中实现相同功能

reactjs react-table
1个回答
0
投票

sinha,我没有发现任何方法来检测扩展更改,但是您可以使用扩展对象,因为它提供了扩展行的状态

const {
    state: { expanded }, // this will give you row/nested-row id with status
  } = useTable(
    {
      columns: userColumns,
      data,
    },
    useExpanded // Use the useExpanded plugin hook
  )

Row expanded

示例:Sandbox react table exapandables

© www.soinside.com 2019 - 2024. All rights reserved.