我是 react 新手。 我使用 react 表来显示我拥有的数据。现在我需要从表中获取特定数据,假设名称来 self 拥有的最后一个 viewIndex 值。我该怎么做?我想要在分页时获得最后一行数据,即所有页面中的数据;
<ReactTable
columns={columns}
data={this.state.users}
defaultPageSize={3}
className="-striped -highlight"
sortable={false}
resizable={false}
style={{
textAlign: "center"
}}
/>
最佳答案
您可以从列中获取viewIndex。
const columns = [
{
Header: 'Name',
accessor: 'name',
Cell: e => {
console.log(e) // viewIndex here
return e.original.name
}
]
之后,您可以按索引或名称过滤 this.state.users。
关于reactjs - React-Table 获取特定行的数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54627995/