Skip to content
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

page size of "all" #1366

Closed
ajax-zoom opened this issue Mar 4, 2017 · 5 comments
Closed

page size of "all" #1366

ajax-zoom opened this issue Mar 4, 2017 · 5 comments

Comments

@ajax-zoom
Copy link

ajax-zoom commented Mar 4, 2017

v2.26.0, a page size of "all" instead of a specific number will be saved and used on reload... forces to have "all" as an option(value) in select which is wrong for the following reasons:

  1. If you have 100.000 entries in the database it will surely break the browser / ajax request are not completed. This is already the case for 3000+ entries. So even if we set a limit for "all" on server side, this is not "All".
  2. maxOptionSize does not make sense any more
  3. Inconsistent behavior - when you have 10 entries in the database, the script selects "all" by actually sending a request of showing 10 rows. If you have 9 entries in the database, parsePageSize returns 10 as selected.

What is the sense of forcing "all"? In case there is a reason behind it which we just not understand, please implement it optional. The only changes needed are inside parsePageSize and updatePageDisplay methods + an option for forcing "all".

Also, AJAX requests might take some time... if we would like to implement a customer loader or maybe something else on start, these couple lines would be perfect in getAjax method (onBeforeGetAjaxFirst and onBeforeGetAjax are options ):

if (p.ajaxCounter == 0 && typeof p.onBeforeGetAjaxFirst === 'function')  {
	p.onBeforeGetAjaxFirst();
}

if (p.ajaxCounter > 0 && typeof p.onBeforeGetAjax === 'function')  {
	p.onBeforeGetAjax();
}
@Mottie
Copy link
Owner

Mottie commented Mar 16, 2017

Hi @ajax-zoom!

Sorry for the long delay in my response! I'm still catching up with issues after returning from my vacation.

You're correct, the behavior of the "all" setting does need to be changed.... please check out #1364. I would also appreciate it if you would test the code in that PR to see if it resolves this issue for you.

maxOptionSize does not make sense any more

This option applies to the page selector, so I'm not sure what you mean by it not making sense.

implement a custom loader

This sounds like a reasonable idea. Alternatively, you could use the customAjaxUrl option to modify the url or perform any other functions before the getAjax method.

@ajax-zoom
Copy link
Author

@Mottie: #1364 does not really solve the issue completly (consider filters etc.). In our opinion parsePageSize method should not return or save "all" if there is no "all" in the pager as an option. "all" should not be sent to server, at least not if configuration does not allow it, so the easiest way is to autodetect "all" in pager or make sending all optionally. We are using a customized version of pager which does work as expected but would like to stick to the project in the long run...

Yes, customAjaxUrl could be abused to trigger a function before ajax request, we did not see it / it was not obvious :-)

Thank you.

@Mottie
Copy link
Owner

Mottie commented Apr 2, 2017

Hi @ajax-zoom!

This should now be fixed in v2.28.6. Please verify this on your end.

@Mottie
Copy link
Owner

Mottie commented Apr 19, 2017

I'm guessing this issue has been resolved, so I'm going to close it. If you continue to have problems, please feel free to continue the discussion in this thread.

@Mottie Mottie closed this as completed Apr 19, 2017
@SangSuantak
Copy link

SangSuantak commented Dec 27, 2017

@Mottie What should i do if i want to send page size with actual values rather than all? I don't know if this matters but this size value will come from a configuration/variable rather than the select (.pagesize).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants