How to get to the first column value

How to get to the first column value

dataTableUserdataTableUser Posts: 4Questions: 2Answers: 0
edited July 2014 in Free community support

I have a delete button at the end of each row

First column in the table is hidden (server row id) ,

How to I get to the first column value given the TR object?

    $('#example').on('click', 'a.editor_remove', function (e) {
        e.preventDefault();

        var oTableApi = $('#example').dataTable().api();
        var tr = $(this).closest('tr');
        alert(tr.first('td').text()); // return all the columns as one text.

Answers

  • dataTableUserdataTableUser Posts: 4Questions: 2Answers: 0
    edited July 2014

    ok i made it

        $('.delete').click(function(e) {
           var tr = $(this).closest('tr');    
       //get the real row index, even if the table is sorted 
       var index = dataTable.fnGetPosition(tr[0]);
       //alert the content of the hidden first column 
       alert(dataTable.fnGetData(index)[0]);
    });
    
This discussion has been closed.