MedicOneSystems / livewire-datatables

Advanced datatables using Laravel, Livewire, Tailwind CSS and Alpine JS
https://livewire-datatables.com/
MIT License
1.19k stars 258 forks source link

Regression? Column filters doesn't work in another page than #1 #315

Closed marionfromfrance closed 2 years ago

marionfromfrance commented 2 years ago

Hi again, I just noticed that curious behaviour : when I filter a column when I'm on page 2 for example, the filter doesn't work (I enter a string which matches with data, but the message "There's Nothing to show at the moment" appears and no data is displayed un table (I don't have any error). It seems it is like that on all pages instead of page 1. Have someone the same issue?

Thanks a lot

Marion

marionfromfrance commented 2 years ago

I just compared with the demo page here https://livewire-datatables.com/complex , and the difference with my datatable is when I apply a filter, there is no redirect to page 1, we are staying on page 2 with ?page=2 in url... if I remove ?page=2, I see my filter applied and data filtered.

In the filter method called (doTextFilter for example), when I replace $this->page = 1; with Trait method $this->setPage(1);, it works, and I can see I hit my test method "updatedPage". If I leave $this->page = 1;, I can't reach updatedPage method.

Anyone with the same issue?

Thanks for your help

marionfromfrance commented 2 years ago

Hi again, it seems the problem comes from the WithPagination Trait, when we have a "page" param in URL, it overrides every other change of the page attribute...

marionfromfrance commented 2 years ago

Hi, I git bisect(ed), and have this result for the first bad commit on livewire : https://github.com/livewire/livewire/commit/52a8605efe48a3900092aac67179531564113eff

I opened an issue here : https://github.com/livewire/livewire/discussions/3996

marionfromfrance commented 2 years ago

pull request https://github.com/MedicOneSystems/livewire-datatables/pull/319