Cell click event not working when table is filtered

Cell click event not working when table is filtered

shakedshaked Posts: 1Questions: 1Answers: 0

This is my code for the column click event:
jQuery('#TheTable tr').each(function() {
jQuery('td', this).slice(-1).on('click', function() {
var tr = $(this).closest('tr');
var row = table.row( tr );
if (row.data() != undefined){
modalfunc(row.data().id);
}
});
});
It's working great normally but when user writes something in search box and table gets filtered - the event is no longer triggered. Is there a way to fix this?

Thank you!

This discussion has been closed.