我创建了一个反应表并使用了蚂蚁设计。
有没有蚂蚁设计的解决方案来允许 expandedRowRender一次只一行功能。
如果展开一行,我想隐藏所有其他展开图标。
这很简单。您将需要利用组件的expandedRowKeys属性<Table />。该属性存储当前展开的行键的值。所以,我们要做的就是只在其上设置当前扩展的行键并删除任何其他行键。
render()<Table
expandedRowKeys={this.state.expandedRowKeys}
onExpand={this.onTableRowExpand}
/>
Run Code Online (Sandbox Code Playgroud)
onExpand 打回来onTableRowExpand(expanded, record){
var keys = [];
if(expanded){
keys.push(record.id); // I have set my record.id as row key. Check the documentation for more details.
}
this.setState({expandedRowKeys: keys});
}
Run Code Online (Sandbox Code Playgroud)
更多阅读: <Table />API 文档
| 归档时间: |
|
| 查看次数: |
8023 次 |
| 最近记录: |