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

Allow for independent query string pagination with multiple datatables on the same page #496

Open elegasoft opened 2 years ago

elegasoft commented 2 years ago

Issue:

If you have multiple DataTables on the same page and you try to paginate one of the DataTables it will appear to only paginate the one DataTables. However, if you refresh the page, all DataTables which are rendered on that page will respond to ?page= queryString and all the tables will jump to the same page. This can mean that a DataTable which does not have the minimum number of pages will render a statement of There's Nothing to show at the moment without rendering it's pagination section leaving that table useless.

Steps to Reproduce:

  1. Have to two or more DataTables render on the same page with one table that has more pages than the another
  2. Paginate to a page which is beyond that of the DataTable with the lesser number of pages
  3. Reload/Refresh the browser window
  4. You'll see There's Nothing to show at the moment on the DataTable with the lesser number of pages and there won't be a way to get that table back to a page which does exist without reloading the page in a way which removes the query string parameter for ?page=

Solution:

Allow setting a $pageName variable for each DataTable thereby mitigating the issue of multiple DataTables responding to the same query string parameters.