0

i have a datable ( #mydatatable ) where i "delegate" an onclick event for each row in it. I can access to the row index like so in following code:

$('#mydatatable').delegate('tr', 'click', function(event) {
    var oSettings = oTable.dataTable().fnSettings();
    var iTotalRecords = oSettings.fnRecordsTotal();
    if(iTotalRecords > 0){      
        var gIDNumber = $(this).attr('id'); // Table ROW index here
            getCellFromTr($(this)); 
    }           
});

But i can´t figure it out, how to get the column index where i cliked:

function getCellFromTr(t){  
  var row = t.parent().children().index(); // This also give's me the row index
  alert('row: ' + row);     
}   

Can someone help me out with this please...

Thank you

Henrique C.
  • 948
  • 1
  • 14
  • 36

0 Answers0