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

Pagination doesn't work after search #252

Closed
yusupprog opened this issue Sep 17, 2017 · 7 comments
Closed

Pagination doesn't work after search #252

yusupprog opened this issue Sep 17, 2017 · 7 comments

Comments

@yusupprog
Copy link

Hi, when i'm searching and results are less than per page, pagination component being removed from page and then when i'm searching again with empty string it throws error

Error in event handler for "vuetable:pagination-data": "TypeError: Cannot read property 'setPaginationData' of undefined"

because it can't find this.$refs.paginatione because it has been removed after first search.
Tried to wrap

<div v-if="tablePagination && tablePagination.last_page > 1" :class="css.wrapperClass">
    <a @click="loadPage(1)"
      :class="['btn-nav', css.linkClass, isOnFirstPage ? css.disabledClass : '']">
        <i v-if="css.icons.first != ''" :class="[css.icons.first]"></i>
        <span v-else>&laquo;</span>
    </a>
...

with another div and it works.

is it a bug?

@ratiw
Copy link
Owner

ratiw commented Sep 17, 2017

I'm not sure if it's a bug. But I haven't encountered this behavior. Last time I checked, everything seems fine to me. Are you using vue-router? If so, that might be the problem.

@yusupprog
Copy link
Author

Yes, I'm using vue-router but error occurs without changing route

@ratiw
Copy link
Owner

ratiw commented Sep 19, 2017

Try to inspect the search result that returned from the server and if the returned result is correct or not. The only thing I can think of is that there's a problem with the returned result.

You can also clone this repo, then run npm install && npm run dev. Play with the sameple, test the search that has only one page result, then try again to search with empty string. You can then look at main.js to see what's different in your implementation.

@lfserrra
Copy link

I'm having the same problem, when I filter somehow that the page is not needed and then when it comes back with an amount that it's possible to paginate it out of that problem.

Could it be some other library or the vue itself?

Here I gave an npm update and this problem occurred.

@ratiw
Copy link
Owner

ratiw commented Sep 21, 2017

This sudden change in v-if behavior might related to vuejs/vue#6632. Will look into it and give an update later.

@ratiw ratiw closed this as completed in cce61ba Sep 21, 2017
@ratiw
Copy link
Owner

ratiw commented Sep 21, 2017

This has been fixed in v1.6.6 of Vuetable-2. See the release note here

ratiw added a commit that referenced this issue Sep 21, 2017
@CrashLaker
Copy link

Hi.

Got the same issue using v1.7.6
i'm also using vue-router

had to

onPaginationData(paginationData) {
            if (this.$refs.paginationTop)
                this.$refs.paginationTop.setPaginationData(paginationData);
            if (this.$refs.paginationInfoTop)
                this.$refs.paginationInfoTop.setPaginationData(paginationData);
            if (this.$refs.pagination)
                this.$refs.pagination.setPaginationData(paginationData);
            if (this.$refs.paginationInfo)
                this.$refs.paginationInfo.setPaginationData(paginationData);
        },

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

No branches or pull requests

4 participants