update dynamic-settings table demo

This commit is contained in:
afc163 2016-12-27 17:47:27 +08:00
parent b0a5601c98
commit 3e00fa8e64

View File

@ -1,5 +1,5 @@
---
order: 22
order: 24
title:
en-US: Dynamic Settings
zh-CN: 动态控制表格属性
@ -62,6 +62,7 @@ for (let i = 1; i <= 10; i++) {
const expandedRowRender = record => <p>{record.description}</p>;
const title = () => 'Here is title';
const showHeader = true;
const footer = () => 'Here is footer';
const scroll = { y: 240 };
@ -73,6 +74,7 @@ class Demo extends React.Component {
size: 'default',
expandedRowRender,
title,
showHeader,
footer,
rowSelection: {},
scroll: undefined,
@ -96,6 +98,10 @@ class Demo extends React.Component {
this.setState({ title: enable ? title : undefined });
}
handleHeaderChange = (enable) => {
this.setState({ showHeader: enable ? showHeader : false });
}
handleFooterChange = (enable) => {
this.setState({ footer: enable ? footer : undefined });
}
@ -126,6 +132,9 @@ class Demo extends React.Component {
<FormItem label="Title">
<Switch checked={!!state.title} onChange={this.handleTitleChange} />
</FormItem>
<FormItem label="Column Header">
<Switch checked={!!state.showHeader} onChange={this.handleHeaderChange} />
</FormItem>
<FormItem label="Footer">
<Switch checked={!!state.footer} onChange={this.handleFooterChange} />
</FormItem>