Get rowindex of clicked row inside clicked event?

Get rowindex of clicked row inside clicked event?

gbrentgbrent Posts: 7Questions: 2Answers: 0

When using responsive tables this is how I am accessing the onclick event of the chosen row. How can I get the row index of the row I clicked from withinside this function?

$('#tableName tbody').on('click', 'td.details-control', function () {
    // How do I get the rowIdx of the row that was clicked here?
}

Answers

  • gbrentgbrent Posts: 7Questions: 2Answers: 0

    Figuered it out. For future refrence if someone has this question....

    var table = $('#tableName').DataTable();
    $('#tableName tbody').on('click', 'tr', function () {
        var data = table.row( this ).data();
        //alert( 'You clicked on '+data[0]+'\'s row' );
    } );
    
This discussion has been closed.