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

Possible to flatten children into rows?

$
0
0

Been looking but not finding an answer... is it possible for datatables to flatten nested data? Given the following json:

{
    "employee": [
        {
            "id": 1,
            "name": "Dave",
            "addresses": [
                {
                    "address": "123 fake street",
                    "zip": "12345"
                },
                {
                    "address": "555 Main Street",
                    "zip": "90210"
                },
            ]
        },
        {
            "id": 2,
            "name": "Steve",
            "addresses": [
                {
                    "address": "923 Lyon Oaks",
                    "zip": "55555"
                }
            ]
        }
    ]
}

I would like the end result to display 3 rows, one for each address. In this example, "dave" would be listed twice (his name repeated, once for each address he has).

Or do I have to flatten it myself on the backend?


Viewing all articles
Browse latest Browse all 82672

Trending Articles



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