Jquery events on Datatable

Jquery events on Datatable

acubinoacubino Posts: 2Questions: 1Answers: 0

Hi.

I a have problem triggering the click or actions in datatable.

If I use as normal JQUERY element, this break when I change to page 2 or another page.

By the way, time ago I found a example using drawCallback.
$('#tbl_usuarios').dataTable( {
'drawCallback': function(settings){
$('.user_link').on('click', function(){
alert('link press');
});

            },      
            "paging":   true,
        "filter":   true,
            "info":     true,
        "lengthMenu": [[25, 10, 50, -1], [25, 10, 50, "All"]]

} );

The problem if when i order using the date or some header element the datatables make a new drawCallback and when I press a .user_link the message is showed a lot of times (the same that i reorder).

I don't found what is the correct method for use the events on datatable.

Thanks.

Answers

  • allanallan Posts: 63,535Questions: 1Answers: 10,475 Site admin

    Top FAQ! :-)

    Allan

  • acubinoacubino Posts: 2Questions: 1Answers: 0

    I promise that I search on google before make this post, but i don't read the faq

    Thanks for the reply.

This discussion has been closed.