Response data is not assigning to DataTable

Response data is not assigning to DataTable

NagarajaCHNagarajaCH Posts: 1Questions: 1Answers: 0

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

  • allanallan Posts: 61,438Questions: 1Answers: 10,052 Site admin

    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

This discussion has been closed.