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 must be reset after new filter #98

Closed
sazary opened this issue Feb 21, 2015 · 12 comments
Closed

Pagination must be reset after new filter #98

sazary opened this issue Feb 21, 2015 · 12 comments
Assignees
Milestone

Comments

@sazary
Copy link

sazary commented Feb 21, 2015

Hi
these are the steps to reproduce this bug:

  1. go to page n >= 2
  2. change a filter criteria, so that the resulting data comes in less pages than n. for example go to page 5, then search for something that has less than 5 pages of data. then table doesn't show anything, but it must show.

how to fix the bug:
reset pagination to page 1 after every change in filters.

@Zizzamia Zizzamia added this to the Version 0.5.1 milestone Feb 21, 2015
@Zizzamia Zizzamia self-assigned this Feb 21, 2015
@Zizzamia
Copy link
Owner

Are you using #ngTasty version 0.5.0 ? This looks an old bug already fix few months ago.

@sazary
Copy link
Author

sazary commented Feb 23, 2015

yes it is 0.5.0

@Zizzamia
Copy link
Owner

What table are we talking about:
Table client side

<div tasty-table bind-resource="resource"> ... </div>

Table server side

<div tasty-table bind-resource-callback="getResource" 
bind-init="init" bind-filters="filterBy"> ... </div>

I try to replicate the error on the docs, but was not possible.

@sazary
Copy link
Author

sazary commented Feb 24, 2015

I'm talking about server side one. follow these steps to reproduce the bug:

  1. go to this page.
  2. search for "s".
  3. go to page 3.
  4. now search for "bar".
  5. note that number of pages in pagination bar reduces to one page, but no item is shown in the table. also note that in the API URL, the page requested is page=3.
  6. now click on page one in the pagination bar. items appear.
    I hope that this helps.

Zizzamia pushed a commit that referenced this issue Mar 10, 2015
@Zizzamia
Copy link
Owner

#ThankYou @sazary to report this issue, was really helpful!
In the next release will be out this fix.

@sazary
Copy link
Author

sazary commented Mar 10, 2015

Thank you for fixing it!

@thesilverbadger
Copy link

I'm not sure that this has been fixed, as we're running into the same issue (using 0.5.5), and I can repro on the Table with reload callback page.

  1. Click Page 5
  2. Enter "cup" in filters by name.
  3. Click Search.

The params string doesn't reset the page to 0, instead leaves it at
[sort-by=name&sort-order=dsc&page=5&count=5&name=cup]

I would expect this to reset the page to 0 (as effectively the user is starting from scratch).

@Zizzamia
Copy link
Owner

Hey @thesilverbadger your problem was fix in the #142 issue.
And if you update #ngTasty to the version 0.5.6 you will get the fix.
Please let me know if you still have problem.

@javmg
Copy link

javmg commented Oct 20, 2015

Hi there,

I think the issue may still be present in the latest version 0.5.8.

We can test it this way:

  1. Navigate to http://zizzamia.com/ng-tasty/directive/table-server-side/complete
  2. Clear the "r" from the filters (by name)
  3. Click on page number 5
  4. Introduce "cup" in the filters (by name)

There is a result but it is not shown (I am attaching a snapshot of the problem). If we click on the page number 1 everything would be fine.

image

Regards,

Javi

@Zizzamia
Copy link
Owner

Hi @javi-more-garc thanks to report the bug,
the docs were not update with the latest version on ngTasty,
http://zizzamia.com/ng-tasty/directive/table-server-side/complete

Just fix that :-)

@javmg
Copy link

javmg commented Oct 28, 2015

Hi,

thank you for your response.

My implementation does not rely on a front-end filter but rather performs a search and the server returns all results sorted/ filtered.

The behavior is analogous: say I search and get 15 results. I click on the second page and search again using a more restrictive filter. The server returns 6 results this time but there are no rows shown even when I can see there is a page:

image

Even the footer is right: "Page 1 of 1, of 6 entries" but there are no rows. If I click on the page (1) everything is fine (i.e. rows are displayed)

Is there any way to sort of reset everything (current page, sorting..) so that the new results from a search are displayed as if it was the first time?

Thank you,

Javier

@Zizzamia
Copy link
Owner

@javi-more-garc can you please open a new issue about this error. :-)
Thanks

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

No branches or pull requests

4 participants