Get cell data

Get cell data

desidocdesidoc Posts: 13Questions: 0Answers: 0
edited October 2013 in DataTables 1.9
Hi,

i have the following code but it doesn't return the value. ¿Can anyone help me?

Thanks


$('#dataTable').on('click', 'td', function(event) {
var sData = $('#dataTable').fnGetData( this );
alert( 'The cell clicked on had the value of '+sData );
} );

Replies

  • desidocdesidoc Posts: 13Questions: 0Answers: 0
    also is there anyway to know the value of a hidden cell?

    Thanks
  • allanallan Posts: 63,381Questions: 1Answers: 10,449 Site admin
    > $('#dataTable').fnGetData( this );

    Should be: `$('#dataTable').dataTable().fnGetData( this );` .

    > also is there anyway to know the value of a hidden cell?

    Use fnGetData on the TR element and it will give you the data for the whole row.

    Allan
  • desidocdesidoc Posts: 13Questions: 0Answers: 0
    Thanks allan, it works perfectly.
This discussion has been closed.