Skip to content

Commit 5ea842b

Browse files
author
Ben Cooling
committed
fix for end/last page & disabled state
1 parent a4aadef commit 5ea842b

File tree

4 files changed

+22
-14
lines changed

4 files changed

+22
-14
lines changed

dist/react-bootstrap-table.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9965,6 +9965,8 @@ return /******/ (function(modules) { // webpackBootstrap
99659965
}, {
99669966
key: 'makePage',
99679967
value: function makePage() {
9968+
var _this3 = this;
9969+
99689970
var pages = this.getPages();
99699971
var isStart = function isStart(page, _ref) {
99709972
var currPage = _ref.currPage,
@@ -9977,7 +9979,7 @@ return /******/ (function(modules) { // webpackBootstrap
99779979
var currPage = _ref2.currPage,
99789980
nextPage = _ref2.nextPage,
99799981
lastPage = _ref2.lastPage;
9980-
return currPage === lastPage && (page === nextPage || page === lastPage);
9982+
return currPage === _this3.lastPage && (page === nextPage || page === lastPage);
99819983
};
99829984
var pageBtns = pages.filter(function (page) {
99839985
if (this.props.alwaysShowAllBtns) {
@@ -9986,11 +9988,13 @@ return /******/ (function(modules) { // webpackBootstrap
99869988
return isStart(page, this.props) || isEnd(page, this.props) ? false : true;
99879989
}, this).map(function (page) {
99889990
var isActive = page === this.props.currPage;
9991+
var isDisabled = isStart(page, this.props) || isEnd(page, this.props) ? true : false;
99899992
return _react2.default.createElement(
99909993
_PageButton2.default,
99919994
{ key: page,
99929995
changePage: this.changePage,
9993-
active: isActive },
9996+
active: isActive,
9997+
disable: isDisabled },
99949998
page
99959999
);
999610000
}, this);

dist/react-bootstrap-table.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/react-bootstrap-table.min.js

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/pagination/PaginationList.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ class PaginationList extends Component {
185185
const isStart = (page, { currPage, pageStartIndex, firstPage, prePage }) =>
186186
(currPage === pageStartIndex && (page === firstPage || page === prePage));
187187
const isEnd = (page, { currPage, nextPage, lastPage }) =>
188-
(currPage === lastPage && (page === nextPage || page === lastPage ));
188+
(currPage === this.lastPage && (page === nextPage || page === lastPage ));
189189
const pageBtns = pages
190190
.filter(function(page) {
191191
if (this.props.alwaysShowAllBtns) {
@@ -197,10 +197,14 @@ class PaginationList extends Component {
197197
}, this)
198198
.map(function(page) {
199199
const isActive = page === this.props.currPage;
200+
const isDisabled = (isStart(page, this.props) || isEnd(page, this.props)) ?
201+
true :
202+
false;
200203
return (
201204
<PageButton key={ page }
202205
changePage={ this.changePage }
203-
active={ isActive }>
206+
active={ isActive }
207+
disable={ isDisabled }>
204208
{ page }
205209
</PageButton>
206210
);

0 commit comments

Comments
 (0)