mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-24 11:10:01 +08:00
update table selection demo
This commit is contained in:
parent
2bdfd36ba0
commit
1e08883315
@ -33,7 +33,7 @@ for (let i = 0; i < 46; i++) {
|
||||
const App = React.createClass({
|
||||
getInitialState() {
|
||||
return {
|
||||
selectedRowKeys: [],
|
||||
selectedRowKeys: [], // 这里配置默认勾选列
|
||||
loading: false,
|
||||
};
|
||||
},
|
||||
|
@ -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} />
|
||||
|
Loading…
Reference in New Issue
Block a user