jquery dataTables warning: table id=IDtableU - Requested unknown parameter '0' for row 0
jquery dataTables warning: table id=IDtableU - Requested unknown parameter '0' for row 0
This is my first time using jquery dataTable pulg-in and I am facing an issue that I can't understand. I am using the server side configuration with JEE servlet. The problem that I get this error message: DataTables warning: table id=IDtableU - Requested unknown parameter '0' for row 0.
this is my dataTable initialisation:
$('#IDtableU').dataTable({
"bServerSide": true, // use server side processing
"sAjaxSource": "/OCSReportingTool/updateuser",//the servlet
"bProcessing": true, // display processing message while fetching
"sPaginationType": "full_numbers",
"bJQueryUI": true,
//"aaData":
[
{ "type_U": "Account type" },
{ "SAMAccName_U": "User Name" },
{ "statusAD":"Status in AD"},
{ "statusDB":"Status in DB"},
{ "department":"Department"},
{ "cc":"Cost Center"},
]// mapping table coloumns with properties in json objects
});
HTML:
<table id=IDtableU>
<thead>
<tr>
<th>User Name </th>
<th>Account type </th>
<th>Department </th>
<th>Cost Center </th>
<th>Status in AD </th>
<th>Status in DB </th>
</tr>
</thead>
<tbody>
</tbody>
</table>
this JSON data sent back from the server (I used firebug to find the server response)
{"iTotalDisplayRecords":10,"iTotalRecords":6320,"aaData":[{"type_U":"local","SAMAccName_U":"NULL","statusAD":"incactive","statusDB":"incactive","department":"NULL","cc":0},{"type_U":"domain","SAMAccName_U":"t_de_ri","statusAD":"incactive","statusDB":"active","department":"NULL","cc":0},{"type_U":"domain","SAMAccName_U":"cbmr","statusAD":"incactive","statusDB":"active","department":"NULL","cc":0},{"type_U":"domain","SAMAccName_U":"a_grzanowskim","statusAD":"active","statusDB":"active","department":"NULL","cc":0},{"type_U":"domain","SAMAccName_U":"KuntzB","statusAD":"active","statusDB":"active","department":"NULL","cc":0},{"type_U":"domain","SAMAccName_U":"a_orglmeisterm","statusAD":"active","statusDB":"active","department":"NULL","cc":0},{"type_U":"domain","SAMAccName_U":"a_mauchg","statusAD":"active","statusDB":"active","department":"NULL","cc":0},{"type_U":"domain","SAMAccName_U":"WittelS","statusAD":"active","statusDB":"active","department":"NULL","cc":0},{"type_U":"domain","SAMAccName_U":"a_egloffm","statusAD":"active","statusDB":"active","department":"NULL","cc":0},{"type_U":"domain","SAMAccName_U":"a_noetzoldr","statusAD":"active","statusDB":"active","department":"NULL","cc":0}],"sEcho":1}
Datatables seems that it has parsed the result and it has successfully get "iTotalDisplayRecords' and 'iTotalRecords" but I get this error message:table id=IDtableU - Requested unknown parameter '0' for row 0 . Please I need your help, I have spent 2 days without fixing the problem it drives me crazy
Answers
You need to use
columns.data
to tell DataTables which data property from the objects belong to each column.Allan