how to repeat the column headers dynamically from json data
how to repeat the column headers dynamically from json data

HI I am new to datatables and i am trying to dynamically add the json data which i got from ajax response to datatbale.
Below is my json data:
{
Solution: "MobileBroadband",
Operator: "MTN"
VNF: [
{
"vendor": "vendor1",
"name": "product1",
"release": "1.0"
},
{
"vendor": "vendor3",
"name": "prodc3",
"release": "3.0"
},
{
"vendor": "saef",
"name": "vEPG",
"release": "2.4"
}
]
},
{
Solution: "CLoud",
Operator: "Airtel"`enter code here`
VNF: [
{
"vendor": "vendor1",
"name": "product1",
"release": "1.0"
},
{
"vendor": "vendor3",
"name": "prodc3",
"release": "3.0"
}
]
},
So i want to take the highest no of vnf's (say for example 3 sets) then vnf-vendor,vnf-name,vnf-release columns should repeat thrice.
Below is the expected output.
This discussion has been closed.
Answers
Pls let me know if this is even possible or not.If not what would be the ideal solution.can i do something like
Hi @kasaranenisri ,
This here will give you a starting point - it's showing how you can extract values from the object that you have.
Cheers,
Colin
Thanks @colin .I found this helpfull,But when i implement the same i am getting an error:
Error i am facing:
Uncaught TypeError: Cannot read property 'forEach' of undefined
at render.
Hi @kasaranenisri ,
You've got lower-case
vnf
in yourcolumns.data
line, in your data structure, and my example, this is capitalised.Cheers,
Colin