get row data

get row data

haraldharald Posts: 8Questions: 2Answers: 0

Hello everyone,

I try to get row data, but it doesn´t work so far...

I have a table with the id 'tableId'. In the last column is an icon, which on click starts a function to export the row data. So far I tried following:

   function getRowData(){
       var table = $('#tableId').DataTable();
       var data_row = table.row($(this).closest('tr')).data();
       console.log(data_row);  // data_row is undefined

I aslo tried:

       var table = $('#tableId').DataTable();

       $('#tableId tbody').on( 'click', 'tr', function () {
           console.log( table.row( this ).data() );
       } );

Would be happy for some help. Thank you!


Sign In or Register to comment.