Configure DataTables to handle array of arrays

Configure DataTables to handle array of arrays

lngphplngphp Posts: 22Questions: 0Answers: 0
edited February 2014 in General
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]

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    You mean like this: http://datatables.net/release-datatables/examples/server_side/object_data.html :-)

    Allan
  • lngphplngphp Posts: 22Questions: 0Answers: 0
    Awesome! Thank you so much!
This discussion has been closed.