Row click with deferRender
Row click with deferRender
JohnEzlab
Posts: 17Questions: 4Answers: 0
On the deferRender page(https://datatables.net/reference/option/deferRender) it contains the following:
Events with deferred rendering:
$('#example tbody').on( 'click', 'td', function () {
alert( 'Clicked on: '+this.innerHTML );
} );
$('#example').dataTable( {
"ajax": "sources/arrays.txt",
"deferRender": true
} );
When I use this example in my code the click
event does not fire. I would guess this is because the datatable body is added after the DOM has loaded.
I have also tried to use something like:
createdRow: function ( row, data, index ) {
$(row).data( "link", $('td', row).find('a')[0].href );
}
but again am unsure where the on click event would go.
Does anyone know how to add a row click when using deferRender?
Thanks.
This discussion has been closed.