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.

Pagination - @input called for each pagination component

See original GitHub issue

When using two pagination components (e.g. above and below a table) that show the same pagination data, the @input will be called twice.

<b-pagination :total-rows="100" :value="page" :per-page="10" @input="toPage"></b-pagination>
<!-- e.g. table -->
<b-pagination :total-rows="100" :value="page" :per-page="10" @input="toPage"></b-pagination>

In this case toPage will be called twice when using either one of the pagination components:

image image

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:17 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
tmorehousecommented, Jun 15, 2017

Components are self contained, and two pagination components do not know about each other, but in your case they are bound to the same value, so a change in that value will trigger a change on both components, hence each firing the @input event whenever the value changes. It would be similar to biding two text inputs to the same value. CHanging the content of one text input would also change the content of the other text input. It is not a bug, as it is the nature of reactivity in Vue.js

1reaction
tmorehousecommented, Jun 15, 2017

Then, use a watcher on your value, and if it changes then call toPage(#) in your watcher function.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pagination | Components - BootstrapVue
<b-pagination> is a custom input component that provides a current page number input control. The value should be bound via v-model in your...
Read more >
Pagination - Bootstrap
Pagination is built with list HTML elements so screen readers can announce the number of available links. Use a wrapping <nav> element to...
Read more >
A simple guide to Pagination in React | by Kunal Nalawade
Inside the Pagination component, create an array that holds all the page numbers from 1 to nPages. Here are several ways to create...
Read more >
React pagination from scratch using Hooks - LogRocket Blog
Create a reusable pagination component from scratch using React Hooks and avoid heavy libraries that may harm your app's performance.
Read more >
Building a Pagination Component in Angular | Joshua Colvin
A pagination component can be used to paginate a list of items. In this article, we will code a pagination component in Angular....
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