Input data to the table
Input data to the table
![AndreyPetlyashenko](https://secure.gravatar.com/avatar/01d154ec05969e6401775d1ca634a22a/?default=https%3A%2F%2Fvanillicon.com%2F01d154ec05969e6401775d1ca634a22a_200.png&rating=g&size=120)
Hello everybody!
Need help
There is an object that comes with
server. This object has keys that contain an array of objects ( datas ). From each array, I want to output a property of objects and write the values to a separate row in the table.
In other words, the number of table rows must be equal to the number of arrays in the object that comes from the backend.
Can I do it?
Here is the code:
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin
Sorry, I had to read it before the post.
Here is the link for the test-case.
https://codepen.io/andreypetlyashenko/pen/vYyEyvY?editors=1111
As you can see, I have two arrays of data. Each array in my data is needed to draw for each row in the table.
Thank you before-hand!
Looking at the data, it sounds like you just want to remove the keys from the objects and have that as an array, unless I'm missing something. So you just need:
then pass that into DataTables with
data
,Colin
Thanks for your help! Everything worked after I had mapped the data to the right format)