iamisti / mdDataTable

Angular data table complete implementation of google material design based on Angular Material components.
MIT License
524 stars 132 forks source link

Ajax Search Support (paginator issue) #196

Open orekav opened 8 years ago

orekav commented 8 years ago

http://iamisti.github.io/mdDataTable/ -> Ajax Search Support

For example, if you go to page 4 and then you search "Palomitas" or "Palou" it stays on page 4! The paginator doesn't restart to page 1. If you go back to page 3, No results, page 2, no Results... page 1... 1 or 2 results and paginators limits change to 1 of 1 page

iamisti commented 8 years ago

Very good catch @orekav !

Will be fixed in the next 24 hour 👍

orekav commented 8 years ago

I saw that when search has not get results, paginator shows 0-0, but when it does... it stills doing the same thing (Stays in an advance page)

[Sorry about my english]

iamisti commented 8 years ago

Hi @orekav , no it doesn't. Did you try it with incognito mode? Just make sure you don't have anything cached.

For me it works fine. If you still experiencing the issue, please write me some repro steps to see it. By the way the original issue is fixed already.

orekav commented 8 years ago

Ajax Search Support

1) Search value: 41 (You'll see 1-5 of 30) 2) Seach value: (empty) 3) Go to page 10 (You'll see 51-55 of 659313) 4) Search value: 41 (You'll see 51-30 of 30) 5) Go one page back (to page 9) --> Empty results and know you can't go to page 10

orekav commented 8 years ago

When I'm on page 10 and search a new Value... It should stays on page 10 if there are rows, if not... it should go to page 1

iamisti commented 8 years ago

good finding! Thanks for reporting it. I'll have a look at it and fix it!

iamisti commented 8 years ago

Fixed with v1.8.8

orekav commented 8 years ago

Fixed with v.1.8.8 or the future release v.1.8.9 ? I tried it again and it did the same thing

iamisti commented 8 years ago

You right, it's still not fixed. I thought I fixed it with one of my fixings but apparently I didn't. I'm fixing it now and will be part of the next release.

pacproduct commented 8 years ago

I'm confirming the bug (with master version, being close to v2.1.0 I guess). When filtering results, the mdt-row-paginator callback (paginatorCallback) gets called with the 1st parameter (page) undefined, and second parameter (pageSize) correctly set though. But in the meantime, the paginator stays on the current page on screen, which is confusing as the server returns the 1st page of filtered data.

I guess the right behavior would be to pass 1 as the 1st parameter (page) and for the paginator to get back to the first page.

An alternative would be to stay on the same page number, but the case is more complex because it would mean that the server would need a way to inform the client to change the page number if there is not enough results to stay on the current page, so that it can switch to a prior page... Sounds unnecessary to me: When filtering, simple reinitialize the page counter to 1, period.