get nested table row data in datatable

get nested table row data in datatable

bilalzafar256bilalzafar256 Posts: 2Questions: 2Answers: 0

I am working on data tables, and i need to create a nested table on button click. I have done this so far but unable to get the nested data table row data.

I used thisexample. This is what i have done so far to get the row data.

    oInnerTable = $('#opiniondt_' + iTableCounter).dataTable({
    data: newArr, 
    autoWidth: true, 
    deferRender: true, 
    info: false, 
    lengthChange: false, 
    ordering: false, 
    paging: false, 
    scrollX: false, 
    scrollY: false, 
    searching: false, 
    columns: [
        {   
            className:      'inner-details-control',
            orderable:      false,
            data:           null,
            defaultContent: '' 
        },
        {"mData": "datasetId"}, 
        {"mData": "name"},
        {"mData": "datasetType", "visible": false},
        {"mData": "parentDatasetID", "visible": false},
        {"mData": "description", "visible": false},
        {"mData": "totalRecords"},
        {"mData": "creationTimeStr"},
        {"mData": "endTimeStr"},
        {bSortable: false,
            mRender: function (o) {return '<button class="btn btn-blue innerDatasetDetailButton" id="innerDatasetDetailButton"><i class="fa fa-check"></i></button>'; }
        }
    ],
    order: [[1, 'asc']]
});

   $('#opiniondt_' + iTableCounter + ' tbody').unbind().on("click", "td.inner-details-control", function () {
    var tr = $(this).closest('tr');
    var row = oInnerTable.row( tr );
    var rowData = oInnerTable.row( tr ).data();  
    iTableCounter = iTableCounter + 1;
    if (row.child.isShown()) {
        row.child.hide();
        tr.removeClass('shown');
    }
    else {
        //createInnerTable(tr, row, rowData);
    }
    });

I have initialized the inner table with oInnerTable but it gives me error on oInnerTable

> TypeError: oInnerTable.row is not a function

Can Any one tell me how can i get row data from nested data table ?

This question has an accepted answers - jump to answer

Answers

This discussion has been closed.