Skip to content

Commit a3f8cfc

Browse files
committed
fix #1278
1 parent 02cdbb5 commit a3f8cfc

File tree

5 files changed

+25
-5
lines changed

5 files changed

+25
-5
lines changed

packages/react-bootstrap-table2-example/examples/pagination/custom-pagination.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ const options = {
4747
lastPageTitle: 'Last page',
4848
showTotal: true,
4949
paginationTotalRenderer: customTotal,
50+
disablePageTitle: true,
5051
sizePerPageList: [{
5152
text: '5', value: 5
5253
}, {
@@ -82,6 +83,7 @@ const options = {
8283
lastPageTitle: 'Last page',
8384
showTotal: true,
8485
paginationTotalRenderer: customTotal,
86+
disablePageTitle: true,
8587
sizePerPageList: [{
8688
text: '5', value: 5
8789
}, {

packages/react-bootstrap-table2-paginator/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ import paginationFactory from 'react-bootstrap-table2-paginator';
5656
* [hideSizePerPage](https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/pagination-props.html#paginationhidesizeperpage-bool)
5757
* [hidePageListOnlyOnePage](https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/pagination-props.html#paginationhidepagelistonlyonepage-bool)
5858
* [showTotal](https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/pagination-props.html#paginationshowtotal-bool)
59+
* [disablePageTitle](https://react-bootstrap-table.github.io/react-bootstrap-table2/docs/pagination-props.html#paginationdisablepagetitle-bool)
5960

6061
You can check [this online demo](https://react-bootstrap-table.github.io/react-bootstrap-table2/storybook/index.html?selectedKind=Pagination&selectedStory=Custom%20Pagination&full=0&addons=1&stories=1&panelRight=0&addonPanel=storybook%2Factions%2Factions-panel) for above props usage.
6162

@@ -233,7 +234,8 @@ nextPageTitle,
233234
firstPageTitle,
234235
lastPageTitle,
235236
onPageChange,
236-
onSizePerPageChange
237+
onSizePerPageChange,
238+
disablePageTitle
237239
```
238240

239241
In most of case, `page`, `sizePerPage`, `onPageChange` and `onSizePerPageChange` are most important things for developer.

packages/react-bootstrap-table2-paginator/src/page-resolver.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ export default ExtendBase =>
107107
return pages;
108108
}
109109

110-
calculatePageStatus(pages = [], lastPage) {
110+
calculatePageStatus(pages = [], lastPage, disablePageTitle = false) {
111111
const {
112112
currPage,
113113
pageStartIndex,
@@ -146,7 +146,11 @@ export default ExtendBase =>
146146
title = `${page}`;
147147
}
148148

149-
return { page, active, disabled, title };
149+
const pageResult = { page, active, disabled };
150+
if (!disablePageTitle) {
151+
pageResult.title = title;
152+
}
153+
return pageResult;
150154
});
151155
}
152156

packages/react-bootstrap-table2-paginator/src/pagination-list-adapter.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,18 @@ import PaginationList from './pagination-list';
77
const paginationListAdapter = WrappedComponent =>
88
class PaginationListAdapter extends pageResolver(Component) {
99
render() {
10-
const { lastPage, totalPages, pageButtonRenderer, onPageChange } = this.props;
11-
const pages = this.calculatePageStatus(this.calculatePages(totalPages, lastPage), lastPage);
10+
const {
11+
lastPage,
12+
totalPages,
13+
pageButtonRenderer,
14+
onPageChange,
15+
disablePageTitle
16+
} = this.props;
17+
const pages = this.calculatePageStatus(
18+
this.calculatePages(totalPages, lastPage),
19+
lastPage,
20+
disablePageTitle
21+
);
1222
return (
1323
<WrappedComponent
1424
pageButtonRenderer={ pageButtonRenderer }

packages/react-bootstrap-table2-paginator/src/pagination.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ Pagination.propTypes = {
9494
currSizePerPage: PropTypes.number.isRequired,
9595
onPageChange: PropTypes.func.isRequired,
9696
onSizePerPageChange: PropTypes.func.isRequired,
97+
disablePageTitle: PropTypes.bool,
9798
pageStartIndex: PropTypes.number,
9899
paginationSize: PropTypes.number,
99100
showTotal: PropTypes.bool,
@@ -117,6 +118,7 @@ Pagination.propTypes = {
117118
};
118119

119120
Pagination.defaultProps = {
121+
disablePageTitle: false,
120122
pageStartIndex: Const.PAGE_START_INDEX,
121123
paginationSize: Const.PAGINATION_SIZE,
122124
withFirstAndLast: Const.With_FIRST_AND_LAST,

0 commit comments

Comments
 (0)