Does "data" field of "columns" works only for Ajax datasource ?

Does "data" field of "columns" works only for Ajax datasource ?

pariveshjainpariveshjain Posts: 2Questions: 1Answers: 0

Does "data" field of "columns" works only for Ajax datasource ?

I have JS array with object something like this :
var tableData =
[
{
"channelName" : "label 1"
},
{
"channelName" : "label 2"
}
]

Now when i try to create datatable with below code then i am getting error. as

Requested unknown parameter 'channelName' for row 0, column 1.

$('#monhtlyEstimateView').DataTable({
"data" : tableData,
"columns": [
{
"title" : "Channel Name",
"data": "channelName",
}
]
});

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,300Questions: 26Answers: 4,945
    Answer ✓

    The code you posted works here:
    http://live.datatables.net/qukeqada/1/edit

    The curious part is the error refers to column 1. Do you have more than one column in your table?

    Kevin

  • pariveshjainpariveshjain Posts: 2Questions: 1Answers: 0

    There was issue in my render method but not sure why debugger was not going inside and was getting datatable warning alert.

    Thanks

  • kthorngrenkthorngren Posts: 21,300Questions: 26Answers: 4,945

    Maybe you can update the example with your data and full Datatables config so we can help debug.

    Kevin

This discussion has been closed.