Asked By: Anonymous
How to keep the current page in data tables in vuetify
when the items is changed.
the current page is 2, add new item to items how to keep the current page 2
Solution
Answered By: Anonymous
Before adding items to the data table, you can save the current page number and re-use it after successfully adding items.
Demo: https://codepen.io/jacobgoh101/pen/odmEER?editors=0011
showFullMats (item) {
// store current page number first
this.prevPage = this.pagination.page;
// codes for adding items...
// reset to page number before adding item
this.$nextTick().then(()=>{
this.$set(this.pagination, 'page', this.prevPage);
});
}