ratiw / vuetable-2

data table simplify! -- datatable component for Vue 2.x. See documentation at
https://vuetable.com
MIT License
2.16k stars 399 forks source link

Query Params value override #548

Open T0miii opened 5 years ago

T0miii commented 5 years ago

I noticed a strange things, so im not sure if im trying to do it the correct way but:

i try to control the table pagination via URL params:

https://my-website.com/#/users?page=2

so when i manually change the url to 3 i have function triggered provided by vue router where i set append-params and refresh the table:

        beforeRouteUpdate (to, from, next) {

            this.$set(this.$data.params, 'page', to.query.page)

            this.$refs.vuetable.refresh()

            next()
        }

this works fine and the table gets paginated even the pagination components goes from 2-3.

What i noticed when i try to do the normal pagination via pagination button, it wont step to the next one. I tracked the problem down and it seems that onPagination data the value is always 3:

            onPaginationData(paginationData) {

                console.log(paginationData); // current_page wont change

                this.$refs.paginationTop.setPaginationData(paginationData)

                this.$refs.paginationBottom.setPaginationData(paginationData)

            },

any idea where to could have gone wrong? Or how am i supposed to change the page value?

ratiw commented 5 years ago

@T0miii I'm not really sure. Maybe try putting this.$refs.vuetable.refresh() inside nextTick() and see if it helps.

gcarrillo-wx commented 4 years ago

I have the same problem. When you return to the page that contains the table and you have set a page number in the query string, pagination does not work. any solution?