mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-30 06:09:34 +08:00
ed455c01d1
* Implement Table.Column and Table.ColumnGroup * Upgrade rc-table
56 lines
915 B
Markdown
56 lines
915 B
Markdown
---
|
|
order: 6
|
|
title:
|
|
en-US: pagination
|
|
zh-CN: 分页
|
|
---
|
|
|
|
## zh-CN
|
|
|
|
数据项较多时显示分页。
|
|
|
|
## en-US
|
|
|
|
when use pagination in table.
|
|
|
|
````jsx
|
|
import { Table } from 'antd';
|
|
|
|
const columns = [{
|
|
title: 'Name',
|
|
dataIndex: 'name',
|
|
render: text => <a href="#">{text}</a>,
|
|
}, {
|
|
title: 'Age',
|
|
dataIndex: 'age',
|
|
}, {
|
|
title: 'Address',
|
|
dataIndex: 'address',
|
|
}];
|
|
|
|
const data = [];
|
|
for (let i = 0; i < 46; i++) {
|
|
data.push({
|
|
key: i,
|
|
name: `Edward King ${i}`,
|
|
age: 32,
|
|
address: `London, Park Lane no. ${i}`,
|
|
});
|
|
}
|
|
|
|
const pagination = {
|
|
total: data.length,
|
|
showSizeChanger: true,
|
|
onShowSizeChange: (current, pageSize) => {
|
|
console.log('Current: ', current, '; PageSize: ', pageSize);
|
|
},
|
|
onChange: (current) => {
|
|
console.log('Current: ', current);
|
|
},
|
|
};
|
|
|
|
ReactDOM.render(
|
|
<Table columns={columns} dataSource={data} pagination={pagination} />
|
|
, mountNode);
|
|
````
|