How can i display value of object array with DataTable
How can i display value of object array with DataTable
Hi,
I'm having this problem, I'm trying to display those values with DataTable. But I got this error message.
'DataTables warning: table id=tbl_method - Requested unknown parameter 'Cleasning' for row 0, column 0.'
Hope someone can advise me where is my mistake. Thank you
--- Here is my sample json data:
[
{
"report_root_cause_cause_id":"1",
"cause_desc":"Cleasning",
"cause_category":"method"
},
{
"report_root_cause_cause_id":"2",
"cause_desc":"Bone",
"cause_category":"material"
}
]
--- Here is my js code:
Answers
You don't want a loop like that to add the data. Datatables will handle that for you since you have your objects in an array. Take a look at this doc, the example is what you want to do:
https://datatables.net/manual/data/#Objects
Kevin