React-Table 获取特定行的数据



我是反应的新手。 我使用反应表来显示我拥有的数据。现在我需要从我的表中获取一个特定的数据,假设名称来自我拥有的最后一个视图索引值。我该怎么做?我在进行分页时想要最后一行数据,即在所有页面中;

<ReactTable
              columns={columns}
              data={this.state.users}
              defaultPageSize={3}
              className="-striped -highlight"
              sortable={false}
              resizable={false}
              style={{
                textAlign: "center"
              }}

            />

您可以从列中获取视图索引。

const columns = [
 {
    Header: 'Name',
    accessor: 'name',
    Cell: e => {
      console.log(e) // viewIndex here
      return e.original.name
    }
]

之后,您可以按索引或名称过滤this.state.users。

最新更新