Configure DataTables to handle array of arrays
Configure DataTables to handle array of arrays
Is it possible to configure DataTables to hanlde array of objects instead of default array of arrays for aaData propery?
When access the page, I get "DataTables warning (table id = 'table_id'): Requested unknown parameter '0' from the data source for row 0"
Here is my JSON:
[code]
{
"sEcho": 1,
"iTotalRecords": "57",
"iTotalDisplayRecords": "57",
"aaData": [
{
"userid": "tM4Ga0zX",
"password": "ZKwMEiIa",
"status_id": 0,
"created": "2014-02-11 09:29:02"
},
{
"userid": "tM4Ga0zX",
"password": "ZKwMEiIa",
"status_id": 0,
"created": "2014-02-11 09:29:02"
},
{
"userid": "tM4Ga0zX",
"password": "ZKwMEiIa",
"status_id": 0,
"created": "2014-02-11 09:29:02"
}
]
}
[/code]
And here is JS:
[code]
$(document).ready(function() {
$('#table_id').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "/users"
} );
});
[/code]
When access the page, I get "DataTables warning (table id = 'table_id'): Requested unknown parameter '0' from the data source for row 0"
Here is my JSON:
[code]
{
"sEcho": 1,
"iTotalRecords": "57",
"iTotalDisplayRecords": "57",
"aaData": [
{
"userid": "tM4Ga0zX",
"password": "ZKwMEiIa",
"status_id": 0,
"created": "2014-02-11 09:29:02"
},
{
"userid": "tM4Ga0zX",
"password": "ZKwMEiIa",
"status_id": 0,
"created": "2014-02-11 09:29:02"
},
{
"userid": "tM4Ga0zX",
"password": "ZKwMEiIa",
"status_id": 0,
"created": "2014-02-11 09:29:02"
}
]
}
[/code]
And here is JS:
[code]
$(document).ready(function() {
$('#table_id').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "/users"
} );
});
[/code]
This discussion has been closed.
Replies
Allan