Empty Data Source causes "requested unknown parameter"
Empty Data Source causes "requested unknown parameter"
I have a datatable setup like such:
[code]
var oTable = $('#documentList').dataTable({
"bPaginate": true,
"iDisplayLength": 50,
"bFilter": true,
"aaSorting": [[ 3, "asc" ]],
"sDom": 'tr<"F"ip>',
"sPaginationType": "bootstrap",
"bProcessing" : true,
"bServerSide": true,
"sAjaxSource": "/Document/GetDocuments/",
"sServerMethod": "POST",
"sDefaultContent": "",
"fnServerParams": function (aoData) {
aoData.push(
{ "name": "isRefresh", "value": true },
{ "name": "projectId", "value": "69606992-3aea-4b4e-9e0b-a0bcb19f68eb" }
);
},
"aoColumns":
[
{
"mData": "DocumentId",
"bVisible": false,
"sName": "DocumentId"
},
{
"mData": null,
"sDefaultContent" : "",
"mRender" : function (data, type, full) {
return '';
}
},
{
"mData": null,
"bSortable": false,
"sDefaultContent": "",
"mRender": function (data, type, full) {
return ''
+ ''
+ '';
}
},
{
"mData": "DocumentNumber",
"sName": "DocumentNumber",
"sTitle": "Document Number"
},
{
"mData": "Title",
"sName": "Title",
"sTitle": "Title"
},
{
"mData": "DateUpdated",
"sName": "DateUpdated",
"sTitle": "Date Updated"
}
],
"fnDrawCallback": function (oSettings) {
$('.icon-edit').tooltip({
"title": "Edit the document"
});
$('.icon-remove').tooltip({
"title": "Move document to trash"
});
$('.icon-eye-open').tooltip({
"title": "View the document details"
});
}
});
[/code]
If I remove these two empty data source columns:
[code]
{
"mData": null,
"sDefaultContent" : "",
"mRender" : function (data, type, full) {
return '';
}
},
{
"mData": null,
"bSortable": false,
"sDefaultContent": "",
"mRender": function (data, type, full) {
return ''
+ ''
+ '';
}
},
[/code]
Everything is great, but leave them in and I get the classic "DataTables warning (table id = 'documentList'): Requested unknown parameter from the data source for row 0.
Any idea what I'm doing incorrect?
[code]
var oTable = $('#documentList').dataTable({
"bPaginate": true,
"iDisplayLength": 50,
"bFilter": true,
"aaSorting": [[ 3, "asc" ]],
"sDom": 'tr<"F"ip>',
"sPaginationType": "bootstrap",
"bProcessing" : true,
"bServerSide": true,
"sAjaxSource": "/Document/GetDocuments/",
"sServerMethod": "POST",
"sDefaultContent": "",
"fnServerParams": function (aoData) {
aoData.push(
{ "name": "isRefresh", "value": true },
{ "name": "projectId", "value": "69606992-3aea-4b4e-9e0b-a0bcb19f68eb" }
);
},
"aoColumns":
[
{
"mData": "DocumentId",
"bVisible": false,
"sName": "DocumentId"
},
{
"mData": null,
"sDefaultContent" : "",
"mRender" : function (data, type, full) {
return '';
}
},
{
"mData": null,
"bSortable": false,
"sDefaultContent": "",
"mRender": function (data, type, full) {
return ''
+ ''
+ '';
}
},
{
"mData": "DocumentNumber",
"sName": "DocumentNumber",
"sTitle": "Document Number"
},
{
"mData": "Title",
"sName": "Title",
"sTitle": "Title"
},
{
"mData": "DateUpdated",
"sName": "DateUpdated",
"sTitle": "Date Updated"
}
],
"fnDrawCallback": function (oSettings) {
$('.icon-edit').tooltip({
"title": "Edit the document"
});
$('.icon-remove').tooltip({
"title": "Move document to trash"
});
$('.icon-eye-open').tooltip({
"title": "View the document details"
});
}
});
[/code]
If I remove these two empty data source columns:
[code]
{
"mData": null,
"sDefaultContent" : "",
"mRender" : function (data, type, full) {
return '';
}
},
{
"mData": null,
"bSortable": false,
"sDefaultContent": "",
"mRender": function (data, type, full) {
return ''
+ ''
+ '';
}
},
[/code]
Everything is great, but leave them in and I get the classic "DataTables warning (table id = 'documentList'): Requested unknown parameter from the data source for row 0.
Any idea what I'm doing incorrect?
This discussion has been closed.
Replies
Are you using DataTables 1.9.4?
Allan
Thanks for the reply.
Yes I'm using the latest DataTables version. I'll continue to poke around and see what's going on. I'll try the above example with my environment and make sure that it works.
Just a Sanity check
Yes, like I said if you remove the two definitions from the javascript, everything functions as normal.
thank you for the comment. I'm still digging around on this.
Happy Halloween!
{
"sEcho": 1,
"iTotalRecords": 1000,
"iTotalDisplayRecords": 1000,
"aaData": [
{
"DocumentId": "22323232",
"DocumentNumber": "000000-SUBPROJID-EQID-(SOURCE)DOCTYPE-001",
"Title": "Document Title",
"DateUpdated": "/Date(1351732826064)/"
}
],
"sColumns": "DocumentId,DocumentNumber,Title,DateUpdated"
}
Thanks all for your help.
CK