mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-18 06:03:38 +08:00
支持动态传入分页信息
This commit is contained in:
parent
fb3b16ddc2
commit
ba61ebd54b
@ -24,7 +24,7 @@ var columns = [{
|
||||
}];
|
||||
var data = [];
|
||||
|
||||
for (let i=0; i<18; i++) {
|
||||
for (let i=0; i<46; i++) {
|
||||
data.push({
|
||||
name: '李大嘴' + i,
|
||||
age: 32,
|
||||
|
@ -26,10 +26,7 @@ export default React.createClass({
|
||||
}
|
||||
|
||||
let noPagination = (this.props.pagination === false);
|
||||
let pagination = objectAssign({
|
||||
pageSize: 10,
|
||||
total: this.props.dataSource.length
|
||||
}, this.props.pagination);
|
||||
let pagination = this.initPagination(this.props.pagination);
|
||||
|
||||
return {
|
||||
selectedRowKeys: [],
|
||||
@ -47,6 +44,21 @@ export default React.createClass({
|
||||
size: 'normal'
|
||||
};
|
||||
},
|
||||
componentWillReceiveProps(nextProps) {
|
||||
if ('pagination' in nextProps) {
|
||||
let noPagination = (nextProps.pagination === false);
|
||||
this.setState({
|
||||
pagination: this.initPagination(nextProps.pagination),
|
||||
noPagination: noPagination
|
||||
});
|
||||
}
|
||||
},
|
||||
initPagination(pagination) {
|
||||
return objectAssign({
|
||||
pageSize: 10,
|
||||
total: this.props.dataSource.length
|
||||
}, pagination);
|
||||
},
|
||||
toggleSortOrder(order, column) {
|
||||
let sortColumn = this.state.sortColumn;
|
||||
let sortOrder = this.state.sortOrder;
|
||||
|
Loading…
Reference in New Issue
Block a user