mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-26 04:00:13 +08:00
Merge pull request #737 from ant-design/feat-table
feat: expose `onShowSizeChange`
This commit is contained in:
commit
8c013e25f1
@ -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) {
|
||||
|
@ -91,7 +91,7 @@
|
||||
"eslint-plugin-react": "^3.3.1",
|
||||
"extract-text-webpack-plugin": "^0.9.1",
|
||||
"gh-pages": "^0.5.0",
|
||||
"history": "~1.13.1",
|
||||
"history": "^1.17.0",
|
||||
"jest-cli": "~0.8.0",
|
||||
"json-loader": "^0.5.1",
|
||||
"less": "~2.5.3",
|
||||
@ -104,7 +104,7 @@
|
||||
"react-addons-test-utils": "~0.14.2",
|
||||
"react-copy-to-clipboard": "^3.0.4",
|
||||
"react-dom": "~0.14.2",
|
||||
"react-router": "~1.0.0",
|
||||
"react-router": "~1.0.3",
|
||||
"react-stateless-wrapper": "~1.0.2",
|
||||
"reqwest": "~2.0.5",
|
||||
"webpack": "^1.10.1",
|
||||
|
Loading…
Reference in New Issue
Block a user