expandedRowRender, onexpand,expandedRowKeys, conflict when using at the same time?!
- showListDom: stores unfold row data
- expandedFunction: requests backend data
- arr: holds the id array of the current row (only one item)
within the render method:
<Table
dataSource={this.state.SampleData}
rowKey={record => record.id || record.key}
columns={columns}
onChange={this.handleStandardTableChange}
pagination={this.state.pagination}
loading={this.state.loading}
expandedRowRender={(record) => { return this.state.showListDom[record.id] || null; }}
onExpand={(expanded, record) => { return this.expandFunction(expanded, record) || null;}}
expandedRowKeys={this.state.arr}//
/>
< hr >
error message:
< hr >
what you want to achieve is that when you click a row, the other lines automatically shrink, expanding only one line at a time.
without expandedRowkeys, the effect can be achieved: when a row (a line) is expanded, click the "+" expander of another row (b line), and b line can get the data and expand it. At the same time, the data of row an is set to empty, but does not shrink (the expander is still "+", the empty table is shown below)