Skip to content

Commit

Permalink
fix missing pagination when data changed.
Browse files Browse the repository at this point in the history
  • Loading branch information
AllenFang committed Oct 18, 2015
1 parent a7e4517 commit 46c93ce
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/BootstrapTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,15 @@ class BootstrapTable extends React.Component{
getTableData() {
let result = [];
if(this.props.pagination){
result = this.store.page(this.props.options.page || 1,
this.props.options.sizePerPage || Const.SIZE_PER_PAGE_LIST[0])
.get();
let page, sizePerPage;
if(this.store.isChangedPage()){
sizePerPage = this.refs.pagination.getSizePerPage();
page = this.refs.pagination.getCurrentPage();
} else {
sizePerPage = this.props.options.sizePerPage || Const.SIZE_PER_PAGE_LIST[0];
page = this.props.options.page || 1;
}
result = this.store.page(page, sizePerPage).get();
} else{
result = this.store.get();
}
Expand Down
4 changes: 4 additions & 0 deletions src/store/TableDataStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,10 @@ export class TableDataStore{
return this.getCurrentDisplayData().length;
}

isChangedPage(){
return this.pageObj.start && this.pageObj.end ? true: false;
}

getAllRowkey(){
return this.data.map(function(row){
return row[this.keyField];
Expand Down

0 comments on commit 46c93ce

Please sign in to comment.