update table selection demo

This commit is contained in:
afc163 2016-03-10 16:55:02 +08:00
parent 2bdfd36ba0
commit 1e08883315
2 changed files with 2 additions and 14 deletions

View File

@ -33,7 +33,7 @@ for (let i = 0; i < 46; i++) {
const App = React.createClass({
getInitialState() {
return {
selectedRowKeys: [],
selectedRowKeys: [], // 这里配置默认勾选列
loading: false,
};
},

View File

@ -12,9 +12,7 @@ import { Table } from 'antd';
const columns = [{
title: '姓名',
dataIndex: 'name',
render(text) {
return <a href="#">{text}</a>;
}
render: text => <a href="#">{text}</a>,
}, {
title: '年龄',
dataIndex: 'age'
@ -43,19 +41,9 @@ const data = [{
const rowSelection = {
getCheckboxProps(record) {
return {
defaultChecked: record.name === '李大嘴', // 配置默认勾选的列
disabled: record.name === '胡彦祖' // 配置无法勾选的列
};
},
onChange(selectedRowKeys) {
console.log(`selectedRowKeys changed: ${selectedRowKeys}`);
},
onSelect(record, selected, selectedRows) {
console.log(record, selected, selectedRows);
},
onSelectAll(selected, selectedRows) {
console.log(selected, selectedRows);
},
};
ReactDOM.render(<Table rowSelection={rowSelection} columns={columns} dataSource={data} />