How to get RowId value from child element in collapsed row

How to get RowId value from child element in collapsed row

orney21d@gmail.comorney21d@gmail.com Posts: 23Questions: 7Answers: 3
edited September 2016 in Free community support

Hi all ,

i have the following structure of rows some times , i using the responsive api, so where resolution is variable some controls are inside child row. The fact is that when i click radiobutton input type , for example that is inside childrow, i'm unable to get the Id data setted throught DT_RowId as is logic:

<tr id="4" class="even parent">...</tr>
<tr class="child">
<input type="radio"
</tr>

i'm try to get Id as follow:

$(document).on('change', '[name = "radio_name"]', function (event) {
        event.preventDefault();
        //Obteniendo el datatable existente en el contexto
        var table = $('.dataTable').DataTable().table(0);
        idRow = table.row($(this).parents('tr')).id();
});

Above code work well where there is not collapsed child row

My question is, there is some method of DataTable to get Id of Parent principal row of the element clicked inside it independently of is collapsed or not...???

Best regards.

Answers

  • orney21d@gmail.comorney21d@gmail.com Posts: 23Questions: 7Answers: 3

    Hi every body,

    This is resolved by me, curiously to recover id of the row by method "id()" when click in child row element is not obtained, so i have develop jquery function to search id value from row parents using "prev()" until get prev row parent with "id" value. However i sow that invoking table.row(this).data() i can get all the data (including "row id"(if exists)) mapped to row, regardless of whether the row is child.

    Best regards.

This discussion has been closed.