- 全部展开 table
This commit is contained in:
parent
10a1f83c8e
commit
be03d101a3
@ -97,6 +97,7 @@ class ResourceList extends PureComponent {
|
||||
modalVisible: false,
|
||||
modalType: 'add', //add update
|
||||
initValues: {},
|
||||
defaultExpandAllRows: false,
|
||||
};
|
||||
|
||||
componentDidMount() {
|
||||
@ -107,6 +108,12 @@ class ResourceList extends PureComponent {
|
||||
});
|
||||
}
|
||||
|
||||
changeExpandAll() {
|
||||
this.setState({
|
||||
defaultExpandAllRows: !this.state.defaultExpandAllRows,
|
||||
});
|
||||
}
|
||||
|
||||
handleModalVisible = (flag, modalType, initValues) => {
|
||||
this.setState({
|
||||
modalVisible: !!flag,
|
||||
@ -168,7 +175,7 @@ class ResourceList extends PureComponent {
|
||||
const {
|
||||
resourceList: { list },
|
||||
} = this.props;
|
||||
const { modalVisible, modalType, initValues } = this.state;
|
||||
const { modalVisible, modalType, initValues, defaultExpandAllRows } = this.state;
|
||||
const parentMethods = {
|
||||
handleAdd: this.handleAdd,
|
||||
handleModalVisible: this.handleModalVisible,
|
||||
@ -243,9 +250,17 @@ class ResourceList extends PureComponent {
|
||||
>
|
||||
新建
|
||||
</Button>
|
||||
<Button type="normal" onClick={() => this.changeExpandAll()}>
|
||||
展开所有行
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
<Table columns={columns} dataSource={list} rowKey="id" />
|
||||
<Table
|
||||
defaultExpandAllRows={defaultExpandAllRows}
|
||||
columns={columns}
|
||||
dataSource={list}
|
||||
rowKey="id"
|
||||
/>
|
||||
</Card>
|
||||
<CreateForm {...parentMethods} modalVisible={modalVisible} />
|
||||
</PageHeaderWrapper>
|
||||
|
Loading…
Reference in New Issue
Block a user