Problem with a clickable row.

Problem with a clickable row.

easyjavaeasyjava Posts: 2Questions: 0Answers: 0
edited October 2013 in DataTables 1.8
Hello and thank you for having developed Datatable!
I'm trying to make a clickable row recovering an ID that is in a hidden column. But it does not work!
Can you help me?
In advance thank you.
[code]
jQuery(function($) {
$(document).ready(function() {
var oTable = $('#customers').dataTable( {
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": "json_customers.php",
"sPaginationType": "full_numbers",
"oLanguage": {
"sUrl": "../../includes/tables/french.txt"
},
"aoColumnDefs": [
{ "bVisible": false, "aTargets": [ 0 ] }
]
} );

/* Add events */
$('#customers tbody tr').click( function () {
var aData = oTable.fnGetData( this );
alert( aData[0] );
} );

} );

});
[/code]

Replies

  • allanallan Posts: 61,972Questions: 1Answers: 10,160 Site admin
    FAQs: http://datatables.net/faqs#ss_events . Use $().on() as a delegated event.

    Allan
  • easyjavaeasyjava Posts: 2Questions: 0Answers: 0
    Thank you
    [code]
    jQuery(function($) {
    $(document).ready(function() {
    var oTable = $('#customers').dataTable( {
    "aaSorting": [[0,'desc']],
    "bProcessing": true,
    "bServerSide": true,
    "sAjaxSource": "json_customers.php",
    "sPaginationType": "full_numbers",
    "aoColumnDefs": [
    { "bVisible": false, "aTargets": [ 0 ] }
    ],
    "fnDrawCallback": function(oSettings) {
    $('#customers tbody tr').bind('click', function () {
    var aData = oTable.fnGetData( this );
    alert( aData[0] );
    })
    }
    } );
    } );
    });
    [/code]
This discussion has been closed.