Loading Datatable using Ajax Source Not Working

Loading Datatable using Ajax Source Not Working

arijit.silarijit.sil Posts: 1Questions: 1Answers: 0

Hi, I am trying to bind my ajax dataSource to the datatable. But I keep on getting the error 'unknown parameter 0'. I have checked the online diagnosis suggested and all the conditions mention there is fine.
Here is a sample of my code

Javascript :

$("#parentTable").DataTable({
dom:
"<'row'<'col-sm-4'l><'#select1.projectSelector col-sm-4'><'#select2.moduleSelector col-sm-4'>>" +
"<'row'<'col-sm-12'tr>>" +
"<'row'<'col-sm-5'i><'col-sm-7'p>>" ,
ajax : {
type:'GET',
url:"BusinessServlet",
dataType:'json',
cache:false,
"processing": true,
"ServerSide": true,
data : {mode:'loadtable'},
contentType:'application/json;charset=utf-8',
"dataSrc": function (json) {
var data = new Array();
var userRequirement = $.parseJSON(JSON.stringify(json)).userRequirement;
alert(userRequirement);
for(var i=0;i< userRequirement.length; i++){
alert(userRequirement[i].sDeveloperAssigned);
data.push({
'sDeveloperAssigned': userRequirement[i].sDeveloperAssigned,
'sDevStatus': userRequirement[i].sDevStatus,
'screenId': userRequirement[i].screenId,
'sCompLevel': userRequirement[i].sCompLevel,
'classificationGroup': userRequirement[i].classificationGroup,
'type': userRequirement[i].type,
'sDesPlannedStartDate': userRequirement[i].sDesPlannedStartDate,
'sDevPlannedEndDate': userRequirement[i].sDevPlannedEndDate
});
}
alert(data);
return data;
},
/* "columnDefs": [{
"defaultContent": "-",
"targets": "_all"
}], */
"columns": [
{ "data": "sDeveloperAssigned"},
{ "data": "sDevStatus"},
{ "data": "screenId"},
{ "data": "sCompLevel"},
{ "data": "classificationGroup"},
{ "data": "type"},
{ "data": "sDesPlannedStartDate"},
{ "data": "sDevPlannedEndDate"}
],

    }
 });

HTML :smile:

<

div id="defectTableList">

Column1 Column2 Column3 Column4 Column5 Column6 Column7 Column8

AJAX Server Response :

Added as an attachment.

Answers

  • orionaseliteorionaselite Posts: 49Questions: 13Answers: 4

    Maybe set

    "processing": false,
    "ServerSide": false,

    just to see what happens

  • allanallan Posts: 63,818Questions: 1Answers: 10,517 Site admin

    "ServerSide": true,

    This isn't going to enable server-side processing anyway since Javascript is case sensitive and the option's name is serverSide.

    @arijit.sil - We'd need a link to the page showing the issue to be able to offer any help.

    Allan

This discussion has been closed.