question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`<b-pagination>` Should not go to the first page when page numbers change

See original GitHub issue

I found the code in paginator.js watch: { numberOfPages(newVal) { if (newVal === this.localNumPages) { /* istanbul ignore next */ return } this.localNumPages = newVal this.currentPage = 1 } },

Why you change currentPage to 1 when the numberOfPages is changed ?

Our use case is: delete all of data in current page, then I go to last page and fetch data again. The currentPage should keep the same as value model.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
luchomaticcommented, Mar 8, 2020

@luchomatic which version are you using of BootstrapVue? b-pagination-nav will adjust the selected page number based on the current route or page URL. b-pagination will change to the first page under certain circumstances (i.e. the current page is greater than the number of pages, etc)

I was able to fix it, my problem was that I loaded the elements to paginate using ajax.

So when my content loaded, it would trigger a pagination pagesCount change, and then it will move the pointer to the first page. (which was my problem and the subject of this thread).

So to solve it I added a “v-if” condition on the paginator to only load it when the content to paginate is already there.

4reactions
stefandesucommented, May 31, 2019

One problem with this is that even when you keep your internal data structure on the correct page, the display of the pagination switches to page 1. What we were doing is to “deny” the page change (by using the @change event only and ignoring the @input event), but even though the data for the correct page was shown, the pagination displayed page 1. The only workaround I could find was to change the page to page 1 and on the next tick, change it back to the previous page so that b-pagination would reevaluate and show the correct page again.

Is there maybe a better way around this?

Edit: I think an option to control this behavior would be best, i.e. some way to deactivate the automatic page change.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Start page numbering later in your document - Microsoft Support
Remove the page number from the first page · Go to Insert > Header or Footer > Edit Header or Edit Footer. ·...
Read more >
How to Start Page Numbering From 1 on a Different Page in ...
Start Page Numbers Within Document​​ To simply skip numbering on the first page, click the "Insert" tab in the ribbon menu, then click...
Read more >
How to Number All Pages Except First in Word 2019 - YouTube
In today's video, you will learn how to number all pages except first in Word 2019.Open the document you want to work with....
Read more >
How to start page numbers after the first few pages in a Word ...
Removing pages numbers from a few but not all pages in a Microsoft Word can be difficult if you don't know about section...
Read more >
Word Tips: Modifying Page Numbers in Word - GCF Global
From there, you'll be able to select Start at: 1. To reformat your numbering, select the page number, then go back to the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found