Should update table data when changing pageSize

fix #317
This commit is contained in:
afc163 2015-09-23 14:28:08 +08:00
parent 74b2c8fcc1
commit 52b639faba
2 changed files with 10 additions and 1 deletions

View File

@ -35,7 +35,8 @@ for (let i=0; i<46; i++) {
var pagination = {
total: data.length,
current: 2
current: 2,
showSizeChanger: true
};
React.render(<Table columns={columns} dataSource={data} pagination={pagination} />

View File

@ -304,6 +304,13 @@ let AntTable = React.createClass({
});
},
handleShowSizeChange(current, pageSize) {
let pagination = objectAssign(this.state.pagination, {
pageSize: pageSize
});
this.fetch({ pagination });
},
renderPagination() {
//
if (!this.hasPagination()) {
@ -321,6 +328,7 @@ let AntTable = React.createClass({
onChange={this.handlePageChange}
total={total}
pageSize={10}
onShowSizeChange={this.handleShowSizeChange}
{...this.state.pagination} /> : null;
},