-
-
Notifications
You must be signed in to change notification settings - Fork 817
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CRM-18286 - Use localStorage to remember datatable page length #8298
Conversation
3467445
to
cf9fd95
Compare
// Strip the ids from ajax urls to make pageLength storage more generic | ||
function simplifyUrl(ajax) { | ||
// Datatables ajax prop could be a url string or an object containing the url | ||
var url = typeof ajax === 'object' ? ajax.url : ajax; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this could be simplified as:
var url = ajax.url || ajax
Successfully replicated the issue on the On the PR's branch, the issue is gone, the datatable page length being remembered after page refresh on all the major browsers |
function simplifyUrl(ajax) { | ||
// Datatables ajax prop could be a url string or an object containing the url | ||
var url = typeof ajax === 'object' ? ajax.url : ajax; | ||
return typeof url === 'string' ? url.replace(/[&?]\w*id=\d+/g, '') : null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if you remove the querystring altogether? Is that too generic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it would apply to all datatables (at least in WP and Joomla where the civi path is part of the query string).
https://issues.civicrm.org/jira/browse/CRM-18286