Reputation: 621
I was trying just modifying one of the examples to do customize a cell:
var oTable = $('#example').dataTable( {
"bProcessing": true,
"sAjaxSource": "sources/deep.txt",
"aoColumns": [
{ "mDataProp": "engine" },
{ "fnRender": function( oObj ) {
return "Test";
} },
{ "mDataProp": "platform.inner" },
{ "mDataProp": "platform.details.0" },
{ "mDataProp": "platform.details.1" }
]
} );
Which uses a source like:
{ "aaData": [
{
"engine": "Trident",
"browser": "Internet Explorer 4.0",
"platform": {
"inner": "Win 95+",
"details": [
"4",
"X"
]
}
},
...
...
Data is displayed correctly but I started getting "DataTables warning (table id = 'example'): Requested unknown parameter '1' from the data source for row 0"
Anything I'm missing? Or I should be doing this in a different way?
Upvotes: 1
Views: 4118
Reputation: 621
With help of official support I found the answer:
An additional parameter needs to be defined in order to avoid that alert:
{ "sDefaultContent": "",
"fnRender": function( oObj ) {
return "Test";
} }
http://datatables.net/forums/discussion/9030/using-fnrender-with-ajax-source-datatable#Item_1
Upvotes: 5
Reputation: 76880
Are you sure thatyour error isn't here
{ "mDataProp": "platform.details.0" },
{ "mDataProp": "platform.details.1" }
that should be
{ "mDataProp": "platform.details[0]" },
{ "mDataProp": "platform.details[1]" }
since details is an array?
Upvotes: 0