Use case: user clicks on a datatable cell. Depending on the row and column of that cell certain action should be executed.
How can I check whether that doesn't click on a certain column and if he does not click on that column, then I would retrieve information from the row he clicked on and allow him to execute an action based on that information.
I did it like this and it works:
var validColumn = false;
$('#fooTable tbody').on( 'click', 'td', function () {
validColumn = $('#fooTable').DataTable().cell(this).index().column !== 5;
});
$('#fooTable tbody').on('click', 'tr', function () {
if (validColumn) {
//do stuff
}
});
But I feel there is a more elegant approach.