2016-03-31 09:40:55 +08:00
|
|
|
---
|
2016-11-22 10:11:12 +08:00
|
|
|
order: 6
|
2016-08-15 07:54:01 +08:00
|
|
|
title:
|
2016-12-19 16:45:58 +08:00
|
|
|
en-US: Pagination
|
2016-08-15 07:54:01 +08:00
|
|
|
zh-CN: 分页
|
2016-03-31 09:40:55 +08:00
|
|
|
---
|
2015-07-09 20:29:26 +08:00
|
|
|
|
2016-08-15 08:07:03 +08:00
|
|
|
## zh-CN
|
2016-08-15 07:54:01 +08:00
|
|
|
|
2016-12-19 16:45:58 +08:00
|
|
|
表格中的分页器可以通过一个配置对象来配置,当 `pagination={false}` 时,会隐藏分页器。
|
2016-08-15 07:54:01 +08:00
|
|
|
|
2016-08-15 08:07:03 +08:00
|
|
|
## en-US
|
2016-08-15 07:54:01 +08:00
|
|
|
|
2016-12-19 16:45:58 +08:00
|
|
|
The pagination in table could be configured with an object, and you can use `pagination={false}` to turn off pagination.
|
2015-07-09 20:29:26 +08:00
|
|
|
|
|
|
|
````jsx
|
2015-10-28 20:55:49 +08:00
|
|
|
import { Table } from 'antd';
|
2015-07-14 15:35:17 +08:00
|
|
|
|
2015-10-28 20:55:49 +08:00
|
|
|
const columns = [{
|
2016-10-02 08:41:41 +08:00
|
|
|
title: 'Name',
|
2015-07-15 10:47:47 +08:00
|
|
|
dataIndex: 'name',
|
2016-11-15 12:01:06 +08:00
|
|
|
render: text => <a href="#">{text}</a>,
|
2015-07-14 15:35:17 +08:00
|
|
|
}, {
|
2016-10-02 08:41:41 +08:00
|
|
|
title: 'Age',
|
2016-05-11 09:32:33 +08:00
|
|
|
dataIndex: 'age',
|
2015-07-14 15:35:17 +08:00
|
|
|
}, {
|
2016-10-02 08:41:41 +08:00
|
|
|
title: 'Address',
|
2016-05-11 09:32:33 +08:00
|
|
|
dataIndex: 'address',
|
2015-07-14 15:35:17 +08:00
|
|
|
}];
|
|
|
|
|
2015-10-28 20:55:49 +08:00
|
|
|
const data = [];
|
2015-11-25 17:35:49 +08:00
|
|
|
for (let i = 0; i < 46; i++) {
|
2015-07-14 15:35:17 +08:00
|
|
|
data.push({
|
2015-08-28 15:22:09 +08:00
|
|
|
key: i,
|
2016-10-02 08:41:41 +08:00
|
|
|
name: `Edward King ${i}`,
|
2015-07-14 15:35:17 +08:00
|
|
|
age: 32,
|
2016-10-02 08:41:41 +08:00
|
|
|
address: `London, Park Lane no. ${i}`,
|
2015-07-14 15:35:17 +08:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2015-10-28 20:55:49 +08:00
|
|
|
const pagination = {
|
2015-07-28 12:26:54 +08:00
|
|
|
total: data.length,
|
2015-12-24 10:12:31 +08:00
|
|
|
showSizeChanger: true,
|
2016-11-15 12:01:06 +08:00
|
|
|
onShowSizeChange: (current, pageSize) => {
|
2015-12-24 10:12:31 +08:00
|
|
|
console.log('Current: ', current, '; PageSize: ', pageSize);
|
2016-01-08 15:28:32 +08:00
|
|
|
},
|
2016-11-15 12:01:06 +08:00
|
|
|
onChange: (current) => {
|
2016-01-08 15:28:32 +08:00
|
|
|
console.log('Current: ', current);
|
2016-05-03 14:15:29 +08:00
|
|
|
},
|
2015-07-14 15:35:17 +08:00
|
|
|
};
|
|
|
|
|
2016-11-15 12:01:06 +08:00
|
|
|
ReactDOM.render(
|
|
|
|
<Table columns={columns} dataSource={data} pagination={pagination} />
|
2015-12-29 12:08:58 +08:00
|
|
|
, mountNode);
|
2015-07-09 20:29:26 +08:00
|
|
|
````
|