Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82604

How to read data from an Array contained in an object (Nested object data (objects))

$
0
0

I have implemented a table fed with JSON data.
The data structure is nested as in the example described on the page:
https://datatables.net/examples/ajax/deep.html

Write a procedure that retrieves data from the onclick event in a table row
data = table.row(this).data()

I retrieve data from objects without any problems. For example:

let start_date = data["hr"]["start_date"]

I have a problem getting data from Arrays objects. I tried different syntaxes, e.g.:

let contact_city = data["contact"][0]

where 0 means the first object in the array.

The console returns an error: Uncaught TypeError: Cannot read properties of undefined (reading '0')

I am sending some of the data returned from data = table.row(this).data()

Please help


Viewing all articles
Browse latest Browse all 82604

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>