livewire-datatables
livewire-datatables copied to clipboard
Allow for independent query string pagination with multiple datatables on the same page
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:
- Have to two or more DataTables render on the same page with one table that has more pages than the another
- Paginate to a page which is beyond that of the DataTable with the lesser number of pages
- Reload/Refresh the browser window
- 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.