Missing parameters (iDisplayStart, iDisplayLength etc)
Missing parameters (iDisplayStart, iDisplayLength etc)
anandsingh2000in
Posts: 2Questions: 1Answers: 0
We are having a strange problem. We are using server side option of the datatable in a Spring application. The parameter in the controller are always null. Will greatly appreciate if someone can give a clue on why our controller does not receive these parameters.
String sEcho = httpRequest.getParameter(S_ECHO);
String sDisplayStart = httpRequest.getParameter(I_DISPLAY_START);
String sDisplayLength = httpRequest.getParameter(I_DISPLAY_LENGTH);
String sSortingCols = httpRequest.getParameter(I_SORTING_COLS);
Here is the usage of datatable:
$('#myTable').DataTable({
"processing": true,
"serverSide": true,
"ajax": {"url": "<c:url value="/task/getTaskListAjax/" />",
"type": "POST"
},
"aoColumns" : [
{
"sTitle" : "Task ID",
"mData" : "taskId"
},
{
"sTitle" : "Task Name",
"mData" : "taskName"
},
{
"sTitle" : "Task Due Date",
"mData" : "taskDueDate"
},
{
"sTitle" : "Task Status",
"mData" : "taskStatus"
}
]
})
});
We are using following versions:
<%--Jquery--%>
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<%--Data Table--%>
<script type="text/javascript" src="https://cdn.datatables.net/1.10.10/js/jquery.dataTables.min.js"></script>
<!-- Bootstrap core CSS -->
<link href="<c:url value="/resources/css/bootstrap.min.css" />" rel="stylesheet">
<link href="<c:url value="/resources/css/navbar.css" />" rel="stylesheet">
<link href="https://cdn.datatables.net/1.10.10/css/jquery.dataTables.min.css" rel="stylesheet">
<script src="<c:url value="/resources/js/bootstrap.min.js" />"></script>
This discussion has been closed.
Answers
You are using some legacy terms on the latest version of DataTables. Try this:
(also includes some features that can help with debugging)
I don't know what your constants are defined as but from the DataTable above, I assume that these too are legacy. https://datatables.net/manual/server-side shows the terms you should be using
Hello bindrid, you are right. We had wrong parameter names. Instead of iDisplayLength, we should have used "length". Thank you so much for saving time for us.
Hi Team, I am facing same issue now, means i am invoking iDisplayLength from Spring but not able getting numberFormatException : null
Kindly help me with this issue
Sounds like your server side processing script is expecting the SSP legacy parameters. If thats the case then you likely will need to use
sAjaxSource
instead of the DT 1.10ajax
option. This section of the SSP doc explains:https://datatables.net/manual/server-side#Legacy
Kevin
Hi Below is my data table code:
table = $("#example").dataTable({
And below is my spring action method :
Now i am not able to get the value of iDisplayLength and iDisplayStart in my action class i have tried both way using sAjaxResource and ajax both
I am getting null value in idisplayLength and iDisplayStart, Kindly help me with solution.
If I get the parameter in my action class using @RequestParam annotation of spring then it is showing below error in my browser :
400 bad request : Required String parameter 'iDisplayStart' is not present
Hi, In HttpServletRequest, i am not able to find anything, request is empty.