vue-paginate icon indicating copy to clipboard operation
vue-paginate copied to clipboard

paginated("items") returns 0 despite :list array is non-empty.

Open paragdiwan opened this issue 5 years ago • 3 comments

Hi I have developed a search component which calls a 'list' component internally to show a list of results. <list :data="searchResults" /> The data is a computed property on list component which either takes a data from store or from property parameter. When in the context of search , I could see that paginated('items') returns 0 where as data exists in the list binding variable.

How to refresh the paginated() to reflect the correct number of items ?

paragdiwan avatar May 21 '19 09:05 paragdiwan

I think I'm having a similar issue. My component starts with a ":list" prop assigned to a computed variable that is an empty array from "vuex", after I add the first element to it instead of starting showing the list "paginated()" keeps returning an empty array, I have to refresh the page to "fix" it.

felipecarmomps avatar Dec 19 '19 13:12 felipecarmomps

I have the same issue.

Looking at the Vue Devtools, I see that the computed property "currentPage" is set to -1. I believe that this is the root cause of the problem.

currentPage:-1
lastPage:2
pageItemsCount:"-9-0 of 20"

marcioelias avatar Jan 16 '20 12:01 marcioelias

I believe the easy fix is to set a watcher on the list, then run this.goToPage(1) after the update to force the current page to 1.

Someone has forked this repo and applied a fix here which works for me: https://github.com/TahaSh/vue-paginate/issues/121#issuecomment-481718494

spacewaffle avatar Apr 02 '20 14:04 spacewaffle