josecebe / twbs-pagination

jQuery pagination plugin (bootstrap powered)
http://josecebe.github.io/twbs-pagination/
Other
1.1k stars 401 forks source link

getCurrentPage does not exist in latest release #161

Closed CodeingBoy closed 6 years ago

CodeingBoy commented 7 years ago

According to examples, I can reinitiate pagination like this:

var currentPage = 1;
if (initiatedPagination) {
  currentPage = $pagination.twbsPagination('getCurrentPage');
  $pagination.twbsPagination("destroy");
}

$pagination.twbsPagination($.extend(COMMON_PAGINATION_OPTIONS, {
  startPage: currentPage,
  totalPages: totalPage
}));
initiatedPagination = true;

Then when I switch pages, browser gave me an error:

Uncaught TypeError: Cannot read property 'apply' of undefined at r.fn.init.e.fn.twbsPagination (jquery.twbsPagination.min.js:9) at Object.fetchCallback [as success] (whatever.js:58) at i (jquery-3.2.1.min.js:2) at Object.fireWith [as resolveWith] (jquery-3.2.1.min.js:2) at A (jquery-3.2.1.min.js:4) at XMLHttpRequest. (jquery-3.2.1.min.js:4)

I thought it was my mistake, but finally I found the "getCurrentPage" have no implementation in 1.4.1, but it do have implementation in the version which example site are using. After replacing with the example one, the code runs very well. So I am wondering if it is a bug?

======================================== Version: Release 1.4.1 from Github release + jQuery 3.2.1 + bootstrap 3.3.7

josecebe commented 6 years ago

This method will be available in 1.4.2 on August 1, 2018. From now, I will try to make a new tag every month if 'master' has changes.