Vuetify: [Bug Report] Pagination totalItems fails to update with array length changes

Created on 2 Jul 2018  路  8Comments  路  Source: vuetifyjs/vuetify

Versions and Environment

Vuetify: 1.1.1
Last working version: 1.0.19
Vue: 2.5.16
Browsers: Chrome 67.0.3396.99
OS: Windows 10

Steps to reproduce

Change items property of a DataTable with v-pagination setup alongside datatable

Expected Behavior

this.pagination.totalItems to be updated with the corresponding dataset

Actual Behavior

this.pagination.totalItems retains original dataset length

Reproduction Link

https://codepen.io/tomdanizer/pen/aKMBgN

Other comments

This happens when appending or completely changing the array dataset. Looks to be related with changes made in the data-iterable.js watchers in
https://github.com/vuetifyjs/vuetify/commit/511329179271f2e4baa1e59deec5178e33fbfcf4#diff-0732a7685c70efc7ecf6b367a2db2396.
Adding the itemsLength watcher back in seemed to fix, but unsure if there are any side-effects.

VDataTable bug

Most helpful comment

Because you are using external validation you will need to update the totalItems yourself.

https://codepen.io/johnjleider/pen/dKrzQB

I'm not sure if this is accounted for in @nekosaur 's rewrite but maybe we should add a watcher in data-iterable for items changes?

All 8 comments

Because you are using external validation you will need to update the totalItems yourself.

https://codepen.io/johnjleider/pen/dKrzQB

I'm not sure if this is accounted for in @nekosaur 's rewrite but maybe we should add a watcher in data-iterable for items changes?

@johnleider A watcher on items is needed for sure - also I am running into this problem, I can't update it manually because of two things;

  1. The data used in the data-table is passed down by a scoped slot
  2. The update event isn't firing when the data is updated

@johnleider I just took a look into https://github.com/vuetifyjs/vuetify/blob/dev/src/mixins/data-iterable.js and there are only two scenario's totalItems is updated

  1. On Init in initPagination()
  2. When ever search is updated in the watcher

Maybe just adding a watcher for this.items.length or this.items so when ever the list updates - the totalItems is also updated fixes this all together

I can take another look at this. I recall a watcher on items was giving me an issue, but I'll confirm. Maybe @nekosaur has some insight as well.

Hi. Have this been fixed? I have a query returning 50k rows but the pages are not updating with the totalItems.

nvm. I've got this working after add the search into the pagination:

pagination: {
search: "",
rowsPerPage: 10,
totalItems: 0
},

@nekosaur is this resolved for v2.0?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ricardovanlaarhoven picture ricardovanlaarhoven  路  3Comments

efootstep picture efootstep  路  3Comments

milleraa picture milleraa  路  3Comments

alterhu2020 picture alterhu2020  路  3Comments

dohomi picture dohomi  路  3Comments