Server side - mData - unknown parameter
Server side - mData - unknown parameter
Hi,
I know that this is a common error an the subject has been already discussed but I still can't get it worked :)
Here is my datatable initialisation :
[code]
rfTable = $('.data-table').dataTable( {
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"aoColumns": [
{ "mData": "dateCreated" },
{ "mData": "name" },
{ "mData": "email"},
],
"bProcessing": true,
"bServerSide": true,
"bPaginate":true,
"fnServerData": fnDataTablesPipeline,
"sAjaxSource": "/datatableAjax",
} );
[/code]
Here is my oaData Return
[code]
{"email":"test","name":"test","dateCreated":"test"}
[/code]
I'm getting this error :
DataTables warning (table id = 'DataTables_Table_0'): Requested unknown parameter 'dateCreated' from the data source for row 0
Where is my problem ? does the datas in my oadData must ben in the same order that the declaration of the mData ?
Thanks
I know that this is a common error an the subject has been already discussed but I still can't get it worked :)
Here is my datatable initialisation :
[code]
rfTable = $('.data-table').dataTable( {
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"aoColumns": [
{ "mData": "dateCreated" },
{ "mData": "name" },
{ "mData": "email"},
],
"bProcessing": true,
"bServerSide": true,
"bPaginate":true,
"fnServerData": fnDataTablesPipeline,
"sAjaxSource": "/datatableAjax",
} );
[/code]
Here is my oaData Return
[code]
{"email":"test","name":"test","dateCreated":"test"}
[/code]
I'm getting this error :
DataTables warning (table id = 'DataTables_Table_0'): Requested unknown parameter 'dateCreated' from the data source for row 0
Where is my problem ? does the datas in my oadData must ben in the same order that the declaration of the mData ?
Thanks
This discussion has been closed.
Replies
There is no `dateCreated` property in your data source objects. Please link to a test case or run the table through the debugger so we can help further.
Allan
http://debug.datatables.net/adutub
Allan
thanks for your time
Allan
I'm getting a new error that leads to a problem in my side :
DataTables warning (table id = 'DataTables_Table_0'): DataTables warning: JSON data from server could not be parsed. This is caused by a JSON formatting error.
So the error is being caused by the browser trying to load HTML from your Ajax request. Which suggests to me that there is a 404 error / the sAjaxSource parameter is wrong.
To see what is returned, click on the 'Tables' button in the debugger and then pick the 'Server interaction' tab.
Allan
There is a way to tell that is json ? When using my overrided method I set dataType to 'json' and there was no error.
thanks
Here is my actual configuration :
[code]
rfTable = $('.data-table').dataTable( {
"bJQueryUI": true,
"sPaginationType": "full_numbers",
"aoColumns": [
{ "mData": "dateCreated" },
{ "mData": "name", sDefaultContent: "" },
{ "mData": "email", sDefaultContent: "" },
],
"bProcessing": true,
"bServerSide": true,
"bPaginate":true,
//"fnServerData": fnDataTablesPipeline,
"sAjaxSource": "/userManagement/admin/search2",
"sServerMethod": "POST"
// "sDom": '<""l>t<"F"fp>',
// "fnServerData": function ( sSource, aoData, fnCallback ) {
// $.ajax( {
// dataType: 'json',
// contentType: "application/json;charset=UTF-8",
// type: 'POST',
// url: sSource,
// data: stringify_aoData(aoData),
// success: fnCallback,
// error : function (e) {
// //alert (e.responseText);
// alert('erreur');
// }
// } );
// }
} );
[/code]
You can see in my commented code, before I was doing : data: stringify_aoData(aoData)
Thanks for you're time, It helps me a lot !