A “defaultContent button” on a DataTable does not work.

A “defaultContent button” on a DataTable does not work.

hkn0945hkn0945 Posts: 2Questions: 1Answers: 0

Hi! Please, I need help!

Description of problem:
It's an application realized with HTML5, JQUERY, BOOTSTRAP and DATATABLES.
One "defaultContent button" in the first Datatable calls a function which fills the second Datatable (this works fine). In the second Datatable, a "defaultContent button" should call another function, but this one does not work: nothing happens after clicking (no error).
Thank you in advance for your help.

Link to test case: https://plnkr.co/plunk/kplB3lIKR76yzXnq

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 20,309Questions: 26Answers: 4,770
    Answer ✓

    The tbody is in the DOM when you create the second event handler. Change your selector to look like this:

    $('#second_table').on('click', 'tbody button.btn_second_click', function () {
    

    Updated example:
    https://plnkr.co/edit/peuW0IAKkzzlCq1h

    Kevin

  • hkn0945hkn0945 Posts: 2Questions: 1Answers: 0

    Hi! Kevin
    I beg your pardon for my delated response. I was very sick and I returned today to my work.
    Your answer works fine.
    Thank you for your time and knowledge.
    Juan Carlos.

  • allanallan Posts: 61,726Questions: 1Answers: 10,110 Site admin

    Hope you are feeling better now :)

    Allan

Sign In or Register to comment.