Add option to reset pagination when last page < current page
Hi Oli,
I had a go at implementing the feature request #3962.
I added the option paginationLastPageErrorResetTo that expects a value of first or last with the default of last.
I'm not convinced by the return from my change (/src/js/modules/Page/Page.js@857). Also would it be best to the the function finish loading ( dispatching the 'pageLoaded' event ) then reload the page ?
Let me know if I need to change anything :)
Cheers Antonio
Hey,
Thanks for the pr. Sorry for the delayed reply, I have been focusing on the website the last couple of weeks
I have a couple of points of feedback.
When you are changing the page no, I would recommend calling the modules internal setPage function instead of updating the variable yourself. That will trigger all the events and request that you need instead of replicating functionality.
You can also pass the word first or last directly to that function and it will take care of the rest.
The default behaviour should probably be to do nothing as it currently does, to allow for people to handle it differently. You could also allow the user to not just pass a string but to pass a callback that could then return the page incase they have a more complex usage case
As for the option name that is a bit on the verbose side. Maybe something like paginationOutOfRange or paginationMaxExceeded
Cheers
Oli :)
Hey Oli,
I made the changes as you suggested.
Just two things:
Is it ok that the DataLoader issues a warning Data Load Response Blocked - An active data load request was blocked by an attempt to change table data while the request was being made. ?
Also is the call to the user supplied function ok paginationOutOfRange.call(this, this.page, this.max) ?
@antman3351 Sorry if this was covered but has this been implemented in the latest releases? We are running into same issue where last page is higher than dataset on revisits using built-in persistence enabled. Simple setting?
e.g. paginationOutOfRange: any documentation?
Edit: Even just simply no settings but error handle and set to page 1 if persistent page is > available. That would be even better!