Response data is not assigning to DataTable
Response data is not assigning to DataTable
HI Allan,
Could you please give me solution for this:
MY json:
{
"draw": 1,
"recordsTotal": 53,
"recordsFiltered": 53,
"data": [
[
{"rd":77019,"pone":0,"ptwo":0},
{"rd"":77844,"pone":0,"ptwo":0}
]
]
}
This data coming from .java file as json element,In the table values are showing like [object Object].
JS function:
$(document).ready(function () {
var table = $("#sims-table").DataTable({
"lengthMenu": [[1, 2, 3, 50, 100, -1], [1, 2, 3, 50, 100, "All"]],
"bProcessing" : true, // Enable processing indicator
"bServerSide" : true, // Configure data option - server or client
"sServerMethod": "POST",
"fnServerParams": function ( aoData ) {
aoData.push( { "name": "id", "value":id} );
},
"sAjaxSource":"Test",
"sPaginationType": "full_numbers",
});
});
Answers
It looks like you have a nested array inside an array in your
data
property.You also need to tell DataTables which property to use for each column since your data source contains objects. See this part of the manual for details on that.
Allan