As easy as it sounds but I am stuck in retrieving the row number
of the current clicked/selected row.
I have tried the following so far.
I am using bootstrap table
just in case you want to know.
$('#myTable').on('click-row.bs.table', function (e, row, $element) {//var row_num = parseInt($(this).parent().index()) + 1;
//var row_num = $(this).closest('tr').index();
//var row_num = $(this).closest('td').parent()[0].sectionRowIndex;
}
None seem to be working for me.
Th problem you have is simply about the way that click-row.bs.table
works, as far as click-row.bs.table
is a table event, this
keyword points to the table itself not to the row, so you just need to use the $element
instead:
$('#myTable').on('click-row.bs.table', function (e, row, $element) {
var row_num = $element.index() + 1;
});