--- order: 27 title: en-US: Dynamic Settings zh-CN: 动态控制表格属性 --- ## zh-CN 选择不同配置组合查看效果。 ## en-US Select different settings to see the result. ```jsx import { Table, Icon, Switch, Radio, Form, Divider } from 'antd'; const FormItem = Form.Item; const columns = [ { title: 'Name', dataIndex: 'name', key: 'name', width: 150, render: text => {text}, }, { title: 'Age', dataIndex: 'age', key: 'age', width: 70, }, { title: 'Address', dataIndex: 'address', key: 'address', }, { title: 'Action', key: 'action', width: 360, render: (text, record) => ( Action 一 {record.name} Delete More actions ), }, ]; const data = []; for (let i = 1; i <= 10; i++) { data.push({ key: i, name: 'John Brown', age: `${i}2`, address: `New York No. ${i} Lake Park`, description: `My name is John Brown, I am ${i}2 years old, living in New York No. ${i} Lake Park.`, }); } const expandedRowRender = record =>

{record.description}

; const title = () => 'Here is title'; const showHeader = true; const footer = () => 'Here is footer'; const scroll = { y: 240 }; const pagination = { position: 'bottom' }; class Demo extends React.Component { state = { bordered: false, loading: false, pagination, size: 'default', expandedRowRender, title: undefined, showHeader, footer, rowSelection: {}, scroll: undefined, hasData: true, }; handleToggle = prop => enable => { this.setState({ [prop]: enable }); }; handleSizeChange = e => { this.setState({ size: e.target.value }); }; handleExpandChange = enable => { this.setState({ expandedRowRender: enable ? expandedRowRender : undefined }); }; handleTitleChange = enable => { this.setState({ title: enable ? title : undefined }); }; handleHeaderChange = enable => { this.setState({ showHeader: enable ? showHeader : false }); }; handleFooterChange = enable => { this.setState({ footer: enable ? footer : undefined }); }; handleRowSelectionChange = enable => { this.setState({ rowSelection: enable ? {} : undefined }); }; handleScollChange = enable => { this.setState({ scroll: enable ? scroll : undefined }); }; handleDataChange = hasData => { this.setState({ hasData }); }; handlePaginationChange = e => { const { value } = e.target; this.setState({ pagination: value === 'none' ? false : { position: value }, }); }; render() { const { state } = this; return (
Default Middle Small Top Bottom Both None
); } } ReactDOM.render(, mountNode); ```