Skip to content

Commit

Permalink
move pagination state to BootstrapTable phase 2
Browse files Browse the repository at this point in the history
  • Loading branch information
AllenFang committed Feb 22, 2016
1 parent d4b8d06 commit 1bcae21
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 24 deletions.
15 changes: 0 additions & 15 deletions src/BootstrapTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,6 @@ class BootstrapTable extends React.Component {
if (this.props.pagination) {
let page, sizePerPage;
if (this.store.isChangedPage()) {
// sizePerPage = this.refs.pagination.getSizePerPage();
// page = this.refs.pagination.getCurrentPage();
sizePerPage = this.state.sizePerPage;
page = this.state.currPage;
} else {
Expand Down Expand Up @@ -345,9 +343,7 @@ class BootstrapTable extends React.Component {
this.store.ignoreNonSelected();
let result;
if (this.props.pagination) {
// let sizePerPage = this.refs.pagination.getSizePerPage();
result = this.store.page(1, this.state.sizePerPage).get();
// this.refs.pagination.changePage(1);
} else {
result = this.store.get();
}
Expand Down Expand Up @@ -427,7 +423,6 @@ class BootstrapTable extends React.Component {
data: result,
currPage: currLastPage,
});
// this.refs.pagination.changePage(currLastPage);
} else {
result = this.store.get();
this.setState({
Expand All @@ -441,16 +436,10 @@ class BootstrapTable extends React.Component {
}

getSizePerPage() {
// if (this.props.pagination) {
// return this.refs.pagination.getSizePerPage();
// }
return this.state.sizePerPage;
}

getCurrentPage() {
// if (this.props.pagination) {
// return this.refs.pagination.getCurrentPage();
// }
return this.state.currPage;
}

Expand Down Expand Up @@ -481,7 +470,6 @@ class BootstrapTable extends React.Component {
const { sizePerPage } = this.state;
let { currPage } = this.state;
let currLastPage = Math.ceil(this.store.getDataNum() / sizePerPage);
// let currentPage = this.refs.pagination.getCurrentPage();
if (currPage > currLastPage)
currPage = currLastPage;
result = this.store.page(currPage, sizePerPage).get();
Expand All @@ -490,7 +478,6 @@ class BootstrapTable extends React.Component {
selectedRowKeys: this.store.getSelectedRowKeys(),
currPage
});
// this.refs.pagination.changePage(currentPage);
} else {
result = this.store.get();
this.setState({
Expand All @@ -510,7 +497,6 @@ class BootstrapTable extends React.Component {
if (this.props.pagination) {
const { sizePerPage } = this.state;
result = this.store.page(1, sizePerPage).get();
// this.refs.pagination.changePage(1);
} else {
result = this.store.get();
}
Expand Down Expand Up @@ -540,7 +526,6 @@ class BootstrapTable extends React.Component {
if (this.props.pagination) {
const { sizePerPage } = this.state;
result = this.store.page(1, sizePerPage).get();
// this.refs.pagination.changePage(1);
} else {
result = this.store.get();
}
Expand Down
9 changes: 0 additions & 9 deletions src/pagination/PaginationList.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,6 @@ import Const from '../Const';

class PaginationList extends React.Component {

// constructor(props) {
// super(props);
// this.state = {
// currentPage: this.props.currPage,
// sizePerPage: this.props.sizePerPage
// };
// }

changePage(page) {
if (page == this.props.prePage) {
page = this.props.currPage - 1 < 1 ? 1 : this.props.currPage - 1;
Expand All @@ -26,7 +18,6 @@ class PaginationList extends React.Component {
}

if (page != this.props.currPage) {
// this.setState({currentPage: page});
this.props.changePage(page, this.props.sizePerPage);
}
}
Expand Down

0 comments on commit 1bcae21

Please sign in to comment.