Pagination buttons change location URL
joebordes opened this issue · comments
I am testing the beta release.
I have a datatable with pagination. On the previous release the page links would launch an ajax call and update the table , now those buttons, show the spinner, scroll to the top and update the URL in the browser location address. The first two new behaviors are fantastic but the URL update is a problem as it breaks the browser history and also gives a raw JSON output if you click on the "reload" browser button.
Can we revert that behavior back so the address URL is not changed? Or is there a way of deactivating that on a per-project setting?
Thanks for feedback @joebordes
Yes, I also noticed same problem. Will remove that first "jump" and URL rewriting on first page and do that only when page changes.
Unfortunately, it is not configurable, so it also will be updated a bit later.
For now I would recommend to stick with 0.11.x if it is not a critical issue. Will update DataTable in few days.
Hi @joebordes
Sorry for a delayed update. Your issue solved in latest release 0.12.3:
DataTable updated:
- Fixed bug which was replacing current URL with AJAX URL, now current URL is updated taking AJAX page and search params into account
- Instead of history push state, replace state now used to allow user to use browser's back button
- On initial (1st page) URL is no more changed
- Added search example into
examples/datatable/index.html
.<input name="search">
can be added within<datatable>
which will add search=value GET param to AJAX request. Server may handle such requests and filter response data. - BunnyJS test API server will have a small delay on page=3 to test loader icon
- ScrollTop and SVG loader moved outside of DataTable and now are separate plugins:
<script src="../../dist/utils-svg.min.js"></script>
<script src="../../dist/spinner.min.js"></script>
<script src="../../dist/datatable.icons.min.js"></script>
<script src="../../dist/element.min.js"></script>
<script src="../../dist/datatable.scrolltop.min.js"></script>
If you will have any questions or some of your issues were not solved, please let me know. If everything is ok for you, please close this issue.
The URL problem is fixed. Thanks!
I haven't tried the search.
I can't see the spinner, neither in my datatable nor in the online demo. I will have a look later and open another ticket if I can't get it working.