mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-29 05:29:37 +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 = {
|
const pagination = {
|
||||||
total: data.length,
|
total: data.length,
|
||||||
current: 1,
|
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} />
|
ReactDOM.render(<Table columns={columns} dataSource={data} pagination={pagination} />
|
||||||
|
@ -410,10 +410,15 @@ let AntTable = React.createClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
handleShowSizeChange(current, pageSize) {
|
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
|
pageSize: pageSize
|
||||||
});
|
});
|
||||||
this.setState({ pagination });
|
this.setState({ pagination: nextPagination });
|
||||||
},
|
},
|
||||||
|
|
||||||
renderPagination() {
|
renderPagination() {
|
||||||
@ -427,12 +432,12 @@ let AntTable = React.createClass({
|
|||||||
});
|
});
|
||||||
let total = this.state.pagination.total || this.getLocalData().length;
|
let total = this.state.pagination.total || this.getLocalData().length;
|
||||||
return (total > 0) ?
|
return (total > 0) ?
|
||||||
<Pagination className={classString}
|
<Pagination {...this.state.pagination}
|
||||||
|
className={classString}
|
||||||
onChange={this.handlePageChange}
|
onChange={this.handlePageChange}
|
||||||
total={total}
|
total={total}
|
||||||
pageSize={10}
|
pageSize={10}
|
||||||
onShowSizeChange={this.handleShowSizeChange}
|
onShowSizeChange={this.handleShowSizeChange} /> : null;
|
||||||
{...this.state.pagination} /> : null;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
prepareParamsArguments(state) {
|
prepareParamsArguments(state) {
|
||||||
|
Loading…
Reference in New Issue
Block a user