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

page is not selected when the array changes the values

Open MateusSilveira98 opened this issue 6 years ago • 17 comments

Is my pug code `

paginate.ptb-0.col-sm-12( name="empresas" :list="empresas" :per="10" )

`.col-sm-4.card-col(v-for='empresa in paginated("empresas")', :key='empresa.id', if='empresa.attributes.ativada')`
       div(@click='openVizualizarEmpresa(empresa.id)', v-if='empresa.attributes.ativada')`
          Cards(:empresa='empresa.attributes')
  paginate-links(for="empresas", :async='true')`

Configuration import VuePaginate from 'vue-paginate' vue.use(VuePaginate)

data () { return { paginate: ['empresas'] } }

I make several filters in this array and it constantly changes, when it is empty according to the filter, the paginate does not show anything (it's right), however when I take the filter and the array takes the elements back, the paginate receives the elements of the array, but it does not select page 1

MateusSilveira98 avatar May 14 '18 15:05 MateusSilveira98

teste

MateusSilveira98 avatar May 14 '18 16:05 MateusSilveira98

I try make a watch in this array and call goToPage(1) method to select a page, but it returns this error: [vue-paginate]: You cannot go to page 1. The last page is 0.

MateusSilveira98 avatar May 14 '18 18:05 MateusSilveira98

@TahaSh @callumacrae @extend1994 @deohnas

MateusSilveira98 avatar May 15 '18 19:05 MateusSilveira98

This is indeed a bug that was introduced with v3.6.0.

I have created a pull request to fix this issue: #95

patrickkivits avatar May 17 '18 08:05 patrickkivits

Ok, thanks. When they merge this pull Request? @patrickkivits

MateusSilveira98 avatar May 17 '18 14:05 MateusSilveira98

No idea, that is up to @TahaSh

In the meantime im just using my own repo in package.json:

"vue-paginate": "https://github.com/patrickkivits/vue-paginate/tarball/master"

patrickkivits avatar May 17 '18 14:05 patrickkivits

Sorry guys for the late response. This should be merged very soon because I'm planning to go through the PRs for the next release.

TahaSh avatar May 17 '18 15:05 TahaSh

I referenced your fork in my package.json and it worked. @patrickkivits

MateusSilveira98 avatar May 17 '18 16:05 MateusSilveira98

Having the same problem here.

rassemdev avatar May 22 '18 04:05 rassemdev

Any updates?

rassemdev avatar May 24 '18 14:05 rassemdev

@rassemdev i'm wait too, for now i did a fork, if your problem is very emergency, i advise you do the same

MateusSilveira98 avatar May 29 '18 16:05 MateusSilveira98

@MateusSilveira98 i dont know how to do it.

rassemdev avatar Jun 06 '18 17:06 rassemdev

I think this is the same issue I'm having. I've made a reproduction specific to my case:

https://jsfiddle.net/rpemberton/L6o1uryb/

When you search for something that doesn't exist, and then the remove the search term, the list doesn't appear again.

The reason is that currentPage changes to -1 and doesn't change back to a natural number.

My quick fix is to simply change this if statement:

https://github.com/TahaSh/vue-paginate/blob/fcff039e90c9e3be5fbc091a47bf67d467fc3cd1/src/components/Paginate.js#L75

to if (this.currentPage >= this.lastPage && this.lastPage) {

rpemberton avatar Jun 07 '18 09:06 rpemberton

This is an issue for me as well. Any word?

occupant avatar Oct 11 '18 19:10 occupant

Sorry to repeat, but when is this being fixed?

I have also created a snippet: https://jsfiddle.net/rpemberton/L6o1uryb/ And searching for inexistent values and clearing the search leaves the list blank.

For example, searching for 'a' OR 'q' recreates this bug.

oflittlemother avatar Nov 16 '18 22:11 oflittlemother

Downgrade to 3.5.0, until merge. It's exactly as @patrickkivits says

frangeris avatar Dec 01 '18 00:12 frangeris

Any updates on this? I am experiencing the same issue on version 3.5.0

adriangordon1231 avatar Nov 12 '19 19:11 adriangordon1231