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

Nested JSON data not appear in table

$
0
0

How to print result from nested JSON like below? I have read multiple answer here but not solve.

This is what I have tried to do but No records to display appear.

DATATABLE

$('#myTable').DataTable({
    processing: true,
    language: {
        zeroRecords         : "No matching records found",
        loadingRecords      : "<img src='img/icon/ani_loading_1.gif'/>",
        emptyTable          : "No records to display",
        searchPlaceholder   : 'Search...',
        sSearch             : '',
        lengthMenu          : '_MENU_ items'
    },
    destroy: true,
    ajax: {
        url: url_pw_route,
        crossDomain : true,
        type : "POST",
        cache : false,
        dataType : "json",
        contentType: "application/json",
        dataSrc : "pw_route.0.pw_route_xc.0",
        data: function(d) {
            return JSON.stringify({"action": "read", "pw_id": pw_id });
        }
    },
    columns: [
        { data : "ne_name", "className": "text-center" }
    ],
});

JSON DATA

{
    "result": "success",
    "pw_route": [
        {
            "pw_route_id": "1",
            "pw_id": "11",
            "pw_route_xc": [
                {
                    "pw_route_id": "11",
                    "ne_name": "NE1"
                },
                {
                    "pw_route_id": "22",
                    "ne_name": "NE2"
                }
            ]
        },
        {
            "pw_route_id": "2",
            "pw_id": "22",
            "pw_route_xc": [
                {
                    "pw_route_id": "333",
                    "ne_name": "NE3"
                }
            ]
        }
    ]
}

Viewing all articles
Browse latest Browse all 82234

Trending Articles



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