Requested unknown parameter '0' from the data source for row 0
Requested unknown parameter '0' from the data source for row 0
ahmed_browserstack
Posts: 1Questions: 0Answers: 0
The minimal code for the ajax loading of rows is as below.
[code]
$table
.dataTable({
"bServerSide": true,
"sAjaxSource": "/deals/deal_data",
fnRowCallback: function(tr, data){
var $html = $(data.html_row);
var $tr = $(tr);
$tr.html($html.html());
}
});
[/code]
Data returned from server in the following format.
[code]
{
aaData: [
{
html_row: 'hellocells'
}
]
}
[/code]
Now I understand why data-table is giving this alert error. As you see I am custom populating the cells.
How can I stop datatable from raising the alert 'Requested unknown parameter '0' from the data source for row 0'.?
[code]
$table
.dataTable({
"bServerSide": true,
"sAjaxSource": "/deals/deal_data",
fnRowCallback: function(tr, data){
var $html = $(data.html_row);
var $tr = $(tr);
$tr.html($html.html());
}
});
[/code]
Data returned from server in the following format.
[code]
{
aaData: [
{
html_row: 'hellocells'
}
]
}
[/code]
Now I understand why data-table is giving this alert error. As you see I am custom populating the cells.
How can I stop datatable from raising the alert 'Requested unknown parameter '0' from the data source for row 0'.?
This discussion has been closed.
Replies
[code]
{
aaData: [
[ 'hello', 'cells' ]
]
}
[/code]
or simile and let DataTables create the HTML.
I must admit I've never seen data passed to DataTables in that form before, and I don't think there is a way to force it to work.
Allan
Thanks for the prompt response!
The reason I am trying to do it that way is because of lot of custom attributes attached to data cells.
As far as I see Its working, I just need to get rid of the error/alert.
Or is there a clean way of attaching the attributes to td's?
Allan
Yes, use DT_RowId ( http://next.datatables.net/manual/server-side#Returned-data ) or fnCreatedRow .
Allan