mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-25 11:40:04 +08:00
feat: expose onShowSizeChange
This commit is contained in:
parent
a84be2c043
commit
38083e5a9f
@ -36,7 +36,10 @@ for (let i = 0; i < 46; i++) {
|
||||
const pagination = {
|
||||
total: data.length,
|
||||
current: 1,
|
||||
showSizeChanger: true
|
||||
showSizeChanger: true,
|
||||
onShowSizeChange: function(current, pageSize) {
|
||||
console.log('Current: ', current, '; PageSize: ', pageSize);
|
||||
}
|
||||
};
|
||||
|
||||
ReactDOM.render(<Table columns={columns} dataSource={data} pagination={pagination} />
|
||||
|
@ -410,10 +410,15 @@ let AntTable = React.createClass({
|
||||
},
|
||||
|
||||
handleShowSizeChange(current, pageSize) {
|
||||
let pagination = objectAssign(this.state.pagination, {
|
||||
const pagination = this.state.pagination;
|
||||
if (pagination.onShowSizeChange) {
|
||||
pagination.onShowSizeChange(current, pageSize);
|
||||
}
|
||||
|
||||
let nextPagination = objectAssign(pagination, {
|
||||
pageSize: pageSize
|
||||
});
|
||||
this.setState({ pagination });
|
||||
this.setState({ pagination: nextPagination });
|
||||
},
|
||||
|
||||
renderPagination() {
|
||||
@ -427,12 +432,12 @@ let AntTable = React.createClass({
|
||||
});
|
||||
let total = this.state.pagination.total || this.getLocalData().length;
|
||||
return (total > 0) ?
|
||||
<Pagination className={classString}
|
||||
<Pagination {...this.state.pagination}
|
||||
className={classString}
|
||||
onChange={this.handlePageChange}
|
||||
total={total}
|
||||
pageSize={10}
|
||||
onShowSizeChange={this.handleShowSizeChange}
|
||||
{...this.state.pagination} /> : null;
|
||||
onShowSizeChange={this.handleShowSizeChange} /> : null;
|
||||
},
|
||||
|
||||
prepareParamsArguments(state) {
|
||||
|
Loading…
Reference in New Issue
Block a user