bootstrap-vue / bootstrap-vue

BootstrapVue provides one of the most comprehensive implementations of Bootstrap v4 for Vue.js. With extensive and automated WAI-ARIA accessibility markup.

Home Page:https://bootstrap-vue.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Stop B-Pagination from Resetting to 1

rezaffm opened this issue · comments

Hi,

so, I have been pulling my hair out of this one.

I tried extending (overwriting) the component, but with no luck.

My goal is to stop b-pagination from resetting the current Page to 1 when I change the number of Pages by changing per Page to a different value, let's say from 10 to 25 or vice versa.

For instance, I tried to uncomment the setting of the page in the watcher, but no success:

  watch: {
    pageSizeNumberOfPages(newValue, oldValue) {
      if (!isUndefinedOrNull(oldValue)) {
        if (newValue.perPage !== oldValue.perPage && newValue.totalRows === oldValue.totalRows) {
          // If the page size changes, reset to page 1
          //  this.currentPage = 1
        } else if (
          newValue.numberOfPages !== oldValue.numberOfPages &&
          this.currentPage > newValue.numberOfPages
        ) {
          // If `numberOfPages` changes and is less than
          // the `currentPage` number, reset to page 1
          //  this.currentPage = 1
        }
      }
      this.localNumberOfPages = newValue.numberOfPages
    }
  },

It still keeps resetting the current Page.

Any help would be highly appreciated.