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.

Dynamically setting the page variable for a datatable-pager only changes the UI

See original GitHub issue

So I have this datatable-pager

<datatable-pager type="abbreviated" v-model="page" :per-page="per_page"></datatable-pager>

And the ‘page’ variable set up:

data() {
      return {
          page: 1,
          per-page: 10
      }
}

Whenever I set the ‘page’ variable to a different value from the code dynamically, like this for example:

this.page = 3;

The only thing that changes is the UI of the datatable-pager to the selected page, but the displayed data doesn’t change, it is still the data of the previous page.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:22 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
sobierocommented, Feb 19, 2019

So I have this datatable-pager <datatable-pager type="abbreviated" v-model="page" :per-page="per_page"></datatable-pager> And the ‘page’ variable set up:

data() {
      return {
          page: 1,
          per-page: 10
      }
}

Whenever I set the ‘page’ variable to a different value from the code dynamically, like this for example: this.page = 3; The only thing that changes is the UI of the datatable-pager to the selected page, but the displayed data doesn’t change, it is still the data of the previous page.

You probably need to call this.$refs.vueDatatable.processRows(); after updating the page variable. Please see issues #63 and #43

Please be more clear. My “this.$refs” is an empty object. How do I include my vue datatable in $refs? and is ‘vueDatatable’ supposed to be the table ID? Thank you.

Sorry, I assumed you had used refs before… Give your datatable a ref i.e. <datatable ref="myAwesomeTable" ..... > </datatable> then call it as this.$refs.myAwesomeTable.processRows();

1reaction
GerkinDevcommented, Mar 12, 2019

Try out the v2.0.0-alpha.0 that I’ve just published. If this version does not solve your issue, please post a fiddle with a minimal repro, or we can’t help.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Alternative pagination - DataTables example
There are six built-in options for which pagination controls DataTables should show: numbers - Page number buttons only; simple - 'Previous' and 'Next' ......
Read more >
How to change the dropdown menu value dynamically - Help
Hi All, i have a situation like i need to change the page number of a datatable dynamically. below is the image of...
Read more >
React table dynamic page size but with size limit and pagination
I am using React Table and i need to set the table rows dynamically depending on the length of my data.
Read more >
How to Convert a Static HTML Table to a Dynamic JavaScript ...
Convert the HTML Table to a Data Grid to allow sorting, filtering and pagination. How to Render Data with HTML Tables. The first...
Read more >
Angular Material Data Table: A Complete Example
The Angular Material Data Table - not only for Material Design ... example for implementing Detail pagination logic in a Master-Detail setup ......
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