Skip to content

Commit

Permalink
fix currPage and sizePerPage lost
Browse files Browse the repository at this point in the history
  • Loading branch information
AllenFang committed Dec 14, 2015
1 parent 64ed6d3 commit f01f6ec
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/BootstrapTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,11 @@ class BootstrapTable extends React.Component {
this.initTable(nextProps);
if (Array.isArray(nextProps.data)) {
this.store.setData(nextProps.data);
this.store.page(nextProps.options.page || 1,
nextProps.options.sizePerPage || Const.SIZE_PER_PAGE_LIST[0]);
let data = this.store.page(nextProps.options.page || this.refs.pagination.getCurrentPage(),
nextProps.options.sizePerPage || this.refs.pagination.getSizePerPage())
.get();
this.setState({
data: this.getTableData()
data: data
});
}
if (nextProps.selectRow && nextProps.selectRow.selected) {
Expand Down Expand Up @@ -655,9 +656,9 @@ BootstrapTable.defaultProps = {
afterSearch: undefined,
afterColumnFilter: undefined,
onRowClick: undefined,
page: 1,
page: undefined,
sizePerPageList: Const.SIZE_PER_PAGE_LIST,
sizePerPage: Const.SIZE_PER_PAGE_LIST[0],
sizePerPage: undefined,
paginationSize: Const.PAGINATION_SIZE,
onSizePerPageList: undefined
},
Expand Down

4 comments on commit f01f6ec

@alisan617
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey Allen,

Quick question on the pagination. How can I add a class name "disabled" to the pagination button, say, if currentPage is 1, of course, the Previous and First button are disabled, because they are not clickable. Same thing for the Next and Last button if you are viewing the last page.

@AllenFang
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alisan617, react-bootstrap-table does not support custom class on pagination buttons. But your feedback is a good improvements, I'll add it in the near future :)
Thanks

@AllenFang
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alisan617, I've done this improvement in newest version. Thanks your feedback :)

@alisan617
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AllenFang Thanks a lot.

Please sign in to comment.