dan3460's avatar

DataTables button not recognized on second page

I have an application that implements yajra datatables. In one of the columns i have a button that when clicked send an email. The button has a class that i use to trigger the action:

$(".salesperson").on('click', function(){
            console.log('salesperson');
            customerNumber = customers.row($(this).closest('tr')).data()[11];
            console.log(customerNumber);
            $.get('/credit/'+customerNumber+'/notifySalesperson');
            $(this).css("background-color","red");
 });

The datatable has pagination. My problem is that when i go to the second page or beyond, the function is not triggered anymore. Any ideas. I don't know what is happening when the button is clicked.

0 likes
3 replies
dan3460's avatar

Yes, that work. Thanks very much.

Please or to participate in this conversation.