Help: Where does iDisplayLength get its default value and why my configuration is ignored?
Help: Where does iDisplayLength get its default value and why my configuration is ignored?
Hello,
I'm a first timer here, so I apologize in advance if I started this topic in a wrong way. Also, congratulations for this fine library, it has great features!
I searched the whole forum for this but unfortunately I did not find (a proper) answer for this.
Some information before explaining in depth the entire issue:
- I am using DataTables with server-side processing, using Ajax calls to fetch the data from DB and process that data before returning through Json to the client-side (I will post my configuration of client-side below);
- I am using the variables iDisplayStart and iDisplayLength in the server-side process to limit and fetch the appropriate data;
- I am using in my client-side configuration both Infinite Scrolling AND Scroller features, although I have tried all 3 possible ways to do what I need (just with I.S., just with Scroller, and using both features at the same time).
My current configuration in client-side (I will post only the part relative to this issue, since my code is actually quite long and has a lot of stuff included):
[code]var oTable = jQuery('#myDataTable').dataTable({
"sServerMethod": "POST",
"bDestroy": true,
"bServerSide": true,
"bJQueryUI": true,
"sAjaxSource": "AjaxHandlerProcessor",
"bDeferRender": true,
"bProcessing": true,
//Infinite Scrolling
"bScrollInfinite": true,
"bScrollCollapse": true,
"iScrollLoadGap": 50,
"sScrollY": "490px",
"sScrollX": "120%",
"iDisplayLength": 50,
"sDom": '<"H"fr>tS<"F"i>',
"aaSorting": [[0, "asc"]],
(...)[/code]
I have tried configuring the iDisplayLength, as you can see, setting it to 50, however for some reason when I fetch the value passed by the Ajax Request it always shows me the value 225. Where is it getting this value? If I remove from configuration the iDisplayLength option, it still gives me this value and it is messing up (I believe) the results.
Also, I believe this is the key to my main problem: when I use the scrolling bar with Infinite Scrolling, somehow after a fewa Ajax calls my records are replicated X times (in chunks).
Can anyone help me please? Unfortunately I cannot create a live example for my problem.
If someone requires more code (or even from my server-side, please say so and I'll do my best to give it.
Thanks in advance and best regards.
I'm a first timer here, so I apologize in advance if I started this topic in a wrong way. Also, congratulations for this fine library, it has great features!
I searched the whole forum for this but unfortunately I did not find (a proper) answer for this.
Some information before explaining in depth the entire issue:
- I am using DataTables with server-side processing, using Ajax calls to fetch the data from DB and process that data before returning through Json to the client-side (I will post my configuration of client-side below);
- I am using the variables iDisplayStart and iDisplayLength in the server-side process to limit and fetch the appropriate data;
- I am using in my client-side configuration both Infinite Scrolling AND Scroller features, although I have tried all 3 possible ways to do what I need (just with I.S., just with Scroller, and using both features at the same time).
My current configuration in client-side (I will post only the part relative to this issue, since my code is actually quite long and has a lot of stuff included):
[code]var oTable = jQuery('#myDataTable').dataTable({
"sServerMethod": "POST",
"bDestroy": true,
"bServerSide": true,
"bJQueryUI": true,
"sAjaxSource": "AjaxHandlerProcessor",
"bDeferRender": true,
"bProcessing": true,
//Infinite Scrolling
"bScrollInfinite": true,
"bScrollCollapse": true,
"iScrollLoadGap": 50,
"sScrollY": "490px",
"sScrollX": "120%",
"iDisplayLength": 50,
"sDom": '<"H"fr>tS<"F"i>',
"aaSorting": [[0, "asc"]],
(...)[/code]
I have tried configuring the iDisplayLength, as you can see, setting it to 50, however for some reason when I fetch the value passed by the Ajax Request it always shows me the value 225. Where is it getting this value? If I remove from configuration the iDisplayLength option, it still gives me this value and it is messing up (I believe) the results.
Also, I believe this is the key to my main problem: when I use the scrolling bar with Infinite Scrolling, somehow after a fewa Ajax calls my records are replicated X times (in chunks).
Can anyone help me please? Unfortunately I cannot create a live example for my problem.
If someone requires more code (or even from my server-side, please say so and I'll do my best to give it.
Thanks in advance and best regards.
This discussion has been closed.
Replies
I'm not sure that paging really works with infinite scrolling - that might be a bug (although I should say that any bugs in infinite scrolling are unlikely to be fixed, as it is about to be deprecated).
Allan
Can you tell me where does the iDisplayLength gets the default value? Where is it implemented? I've searched the whole application and I simply cannot see it. I'm sure there must be some place where you assign it, for the cases when people do not manually configure it?
So if Infinite Scrolling is going to be deprecated, should I stick simply and only with Scroller feature? Are there any known issues when using both I.S. and Scroller at the same time?
Is there any chance at all that you can point out real live examples of server-side processing with Ajax calls, in which the data is fetched from DB? (I suppose the implementation language doesn't really matter, but only the logic behind it). I would love to have real sample of the server-side, because I'm almost sure the problem lies there somewhere with the usage of the iDisplayStart and iDisplayLength.
Thanks again and I hope to hear from you again soon!
https://github.com/DataTables/DataTables/blob/master/media/js/jquery.dataTables.js#L10029
> So if Infinite Scrolling is going to be deprecated, should I stick simply and only with Scroller feature? Are there any known issues when using both I.S. and Scroller at the same time?
I would recommend scroller over infinite scrolling, yes. Also, it is impossible to use both infinite scrolling and scroller at the same time.
> Is there any chance at all that you can point out real live examples of server-side processing with Ajax calls
http://datatables.net/release-datatables/examples/server_side/server_side.html
Allan
As for the I.S. vs Scroller dilemma, thanks for clearing it up. I believe I'll stick with Scroller then! :)
And last but not least, thanks for pointing out that link with the server side example. I don't know how I missed it. And trust me, I've spent hours reading up on the documentation and examples!
Unfortunately, I still haven't solved my problem, but perhaps removing the Infinite Scrolling configs will help a little.
Cheers.