Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ant-design 中 Tbale 可展开手动操作范例 #3

Closed
gaofant101 opened this issue Jun 16, 2017 · 2 comments
Closed

Ant-design 中 Tbale 可展开手动操作范例 #3

gaofant101 opened this issue Jun 16, 2017 · 2 comments

Comments

@gaofant101
Copy link
Owner

在官网只展示了提供按钮的可展开,没有详细介绍主动触发调用界面展开API;

在经过一翻查找过后,可以通过expandedRowKeysexpandedRowKeys这个2个API实现;

下面是截取的部分代码展示:

onExpandedRowsChange(rows) {
    this.setState({
        expandedRowKeys: rows,
    });
}
showTCellInfo(key) {
    if (this.state.expandedRowKeys.length) {
        this.setState({
            expandedRowKeys: [],
        });
    } else {
        this.setState({
            expandedRowKeys: [key],
        });
    }
}
<Table
  columns={tableColumns}
  expandedRowKeys={expandedRowKeys}
  onExpandedRowsChange={this.onExpandedRowsChange}
  expandedRowRender={(record) => <p>{record.description}</p>}
  dataSource={dataSource}
/>

上面代码还需要进一步完善,expandedRowKeys这里面的值需要准确的判断;

官方示例

@gaofant101 gaofant101 changed the title Ant-designTbale可展开手动操作范例.md Ant-designTbale可展开手动操作范例 Jun 16, 2017
@afc163
Copy link

afc163 commented Jun 19, 2017

对,这个遵循了通用的 React 受控模式,演示不太可能把所有可能都演示一遍。

@gaofant101
Copy link
Owner Author

@afc163 就官方文档而言,已经做的非常完善了;
如果开发者自己想要做什么操作,有心人总能找到答案.

@gaofant101 gaofant101 reopened this Jun 28, 2017
@gaofant101 gaofant101 changed the title Ant-designTbale可展开手动操作范例 Ant-design 中 Tbale 可展开手动操作范例 Dec 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants