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

[Feature Request] VDataTable automatically return to first page #10949

Open
Teellcory opened this issue Mar 26, 2020 · 9 comments
Open

[Feature Request] VDataTable automatically return to first page #10949

Teellcory opened this issue Mar 26, 2020 · 9 comments
Labels
C: VDataTable VDatatable T: feature A new feature

Comments

@Teellcory
Copy link

Problem to solve

If you have a table with dynamic content (e.g. 200 rows) and have pagination set to 50 and go to page 3. Then do something externally to change the number of rows down to 20, the table will stay at the position of "150-20 of 20"

Proposed solution

If the table detects that the current position is beyond the total number of pages, it returns to page 1.

@manonthemat
Copy link

A user of Yomi.ai noticed and documented the same behavior here.

search

Using Vuetify 2.2.27.

@mwgamble
Copy link

I think it's generally ideal for any kind of filtering action (including removal of filters) to reset pagination.

@bmsoftware2020
Copy link

I facing this problem and never find the solution to fix.

@stianl
Copy link

stianl commented May 31, 2021

Here's my take on it - codepen based on example from Server-side paginate and sort. I've changed the items per page to 5 so there is pagination.

I've added a search property that is watched (in addition to options). In the handler I reset the page count. If I you don't do this and search for "f" on page 2 - Frozen Yogurt will not show up.

@bencun
Copy link

bencun commented Jun 17, 2021

I can confirm this issue. If I go forward two pages, perform search, get the response and update the table data I get something like this in the footer:
21-1 of 1
The page navigation still allows me to go back to the first page.

I do update the server-items-length to the new search results' array length and page to 1 but this still doesn't help.

It's server side pagination, obviously.

@simonmaass
Copy link

I just encountered the same problem.... any solutions yet?

@shaunthambyah
Copy link

@stianl's code is an excellent example (and probably should have a reference in the docs). I think the key here is to set whatever variable you are using as the page sync, whether its via individual props or options before making the call to your API.

@adamjimenez
Copy link

I have a similar issue. See demo.

Go to page 2. The button sets page to 1, but it doesn't react.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: VDataTable VDatatable T: feature A new feature
Projects
None yet
Development

No branches or pull requests