Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

page is not selected when the array changes the values #94

Open
MateusSilveira98 opened this issue May 14, 2018 · 17 comments · May be fixed by #99
Open

page is not selected when the array changes the values #94

MateusSilveira98 opened this issue May 14, 2018 · 17 comments · May be fixed by #99

Comments

@MateusSilveira98
Copy link

MateusSilveira98 commented May 14, 2018

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
Copy link
Author

teste

@MateusSilveira98
Copy link
Author

MateusSilveira98 commented May 14, 2018

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
Copy link
Author

@patrickkivits
Copy link

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

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

@MateusSilveira98
Copy link
Author

MateusSilveira98 commented May 17, 2018

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

@patrickkivits
Copy link

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"

@TahaSh
Copy link
Owner

TahaSh commented May 17, 2018

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.

@MateusSilveira98
Copy link
Author

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

@rassemdev
Copy link

Having the same problem here.

@rassemdev
Copy link

Any updates?

@MateusSilveira98
Copy link
Author

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

@marcovdb marcovdb linked a pull request Jun 4, 2018 that will close this issue
@rassemdev
Copy link

@MateusSilveira98 i dont know how to do it.

@rpemberton
Copy link

rpemberton commented Jun 7, 2018

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:

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

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

@occupant
Copy link

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

@oflittlemother
Copy link

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.

@frangeris
Copy link

frangeris commented Dec 1, 2018

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

@adriangordon1231
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants