提交 be03d101 authored 作者: sin's avatar sin

- 全部展开 table

上级 10a1f83c
...@@ -97,6 +97,7 @@ class ResourceList extends PureComponent { ...@@ -97,6 +97,7 @@ class ResourceList extends PureComponent {
modalVisible: false, modalVisible: false,
modalType: 'add', //add update modalType: 'add', //add update
initValues: {}, initValues: {},
defaultExpandAllRows: false,
}; };
componentDidMount() { componentDidMount() {
...@@ -107,6 +108,12 @@ class ResourceList extends PureComponent { ...@@ -107,6 +108,12 @@ class ResourceList extends PureComponent {
}); });
} }
changeExpandAll() {
this.setState({
defaultExpandAllRows: !this.state.defaultExpandAllRows,
});
}
handleModalVisible = (flag, modalType, initValues) => { handleModalVisible = (flag, modalType, initValues) => {
this.setState({ this.setState({
modalVisible: !!flag, modalVisible: !!flag,
...@@ -168,7 +175,7 @@ class ResourceList extends PureComponent { ...@@ -168,7 +175,7 @@ class ResourceList extends PureComponent {
const { const {
resourceList: { list }, resourceList: { list },
} = this.props; } = this.props;
const { modalVisible, modalType, initValues } = this.state; const { modalVisible, modalType, initValues, defaultExpandAllRows } = this.state;
const parentMethods = { const parentMethods = {
handleAdd: this.handleAdd, handleAdd: this.handleAdd,
handleModalVisible: this.handleModalVisible, handleModalVisible: this.handleModalVisible,
...@@ -243,9 +250,17 @@ class ResourceList extends PureComponent { ...@@ -243,9 +250,17 @@ class ResourceList extends PureComponent {
> >
新建 新建
</Button> </Button>
<Button type="normal" onClick={() => this.changeExpandAll()}>
展开所有行
</Button>
</div> </div>
</div> </div>
<Table columns={columns} dataSource={list} rowKey="id" /> <Table
defaultExpandAllRows={defaultExpandAllRows}
columns={columns}
dataSource={list}
rowKey="id"
/>
</Card> </Card>
<CreateForm {...parentMethods} modalVisible={modalVisible} /> <CreateForm {...parentMethods} modalVisible={modalVisible} />
</PageHeaderWrapper> </PageHeaderWrapper>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论