Need help in identfying the iDisplayLength default value while migrating from 1.9.2. to 1.13.7
Need help in identfying the iDisplayLength default value while migrating from 1.9.2. to 1.13.7
I am trying to migrate my project to the latest jQuery datatable version.In the old version(1.9.2) I noticed that it is taking the default value for iDisplayLength as 234.I tried searching the whole code and I couldnt understand where the value is set.In 1.13.7 version it is taking the default value as 10,I understand this is the default value defined in the dataTables.js file.
Can anyone help me identifying where the value '234' is set in the older version please.
Thanks in advance.
Answers
Do you mean that you think DataTables' default was 234? It has been 10 since its very first release, and I doubt it will ever change. It certainly wasn't 234.
If you link to your page where it is 234 then I'll probably be able to identify where that is being done.
If you want to set the page length with the latest DataTables, use
pageLength
.Allan
Thanks for your response Allan.I dont see it explicitly set in my code as well.I am new to jQuery.Probably I am overlooking something which is obvious.The length is set to display based on the below code snippet:
$.get('List.action',
{
mode: 'allcamerasforrcc',
rccId: selectedRCC,
dataTable: true,
sid: Math.random(),
iDisplayStart: settings._iDisplayStart,
iDisplayLength: settings._iDisplayLength,
sSearch: searchString,
sSortDir_0: settings.aaSorting[0][1],
road: lastFilteredOn,
statusOnly: true
},
The value in settings._iDisplayLength is 234.Not sure where it is picking from.We are also using datatables.scroller.js in our project.Does it have any dependancy on the scroller?
I would look through your Javascript code to see where
settings._iDisplayLength
is set. Datatables wouldn't set that or any of the other above variables.Kevin
what is the best approach to share the code as I dont want to post the entire file here.
Thanks!!
I hope you are looking for this.It is fetched from fnSettings() and set it in settings variable.I dont have much idea on how fnSettings works.
function refreshDataTable(){
Possibly Github or other source code repository. It may not execute but you can place the code in one of these resources for test cases:
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin
Are you using Scroller? That will increase the default page length.
Like Kevin says, we need a test case so we have all the information available.
Allan
Hi Allan,
I have placed my function in the below path :
https://live.datatables.net/mafucexa/1/
Before upgrade we were using jquery.dataTables-1.9.2.min.js and dataTables.scroller.min.js version 1.1.0.
When using the old version,I noticed that the below fn from scroller is called and the iDisplayLength value is set to 234 in aoData.
I have upgraded the libraries to jquery.dataTables-1.13.7.min.js and dataTables.scroller-2.4.0.min.js.After upgrading I ]observed that the scroller fn is not being called and hence the iDisplayLength value is set to 10 which is default value.
Could you help me figure out what's wrong with the new libraries and why the scroller isn't getting called?
Thanks!!
Can you link me to a running test case please? That page just has some JS code (which I've never see that subdomain do quite like that before).
Also, is there a reason you didn't update to DataTables 2. If you are jumping from 1.9 to 1.13, you might as well go to 2, given that 1.x is no longer supported (unless you have a support contract).
Allan
Sorry I havent attached the test case.I have provided the function from js file in our project which we have used to render the dataTable for your reference.
We stick with version 1.13.7 since that was the most recent when I started the upgrade.The website states that 1.x is still supported..Is it not the case?
Only the latest versions are "officially" supported (i.e. I'm unlikely to patch an issue in 1.x unless it is a security issue).
Are you able to produce a test case please? I can't debug the JS from the link above.
Allan