How can i display value of object array with DataTable
How can i display value of object array with DataTable
![rahim0704](https://secure.gravatar.com/avatar/8fc6bdd1ce1944d8e60ac2d6913f3af3/?default=https%3A%2F%2Fvanillicon.com%2F8fc6bdd1ce1944d8e60ac2d6913f3af3_200.png&rating=g&size=120)
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