button click datatables code example

Example 1: datatable buttons

dom: 'Blfrtip',
    buttons: [
        {
            extend: 'excelHtml5',
            footer: true,
        },
        {
            extend: 'csvHtml5',
            footer: true,
        },
        {
            extend: 'pdfHtml5',
            footer: true,
        },
    ],
    lengthMenu: [[10, 25, 50, 100, -1], [10, 25, 50, 100, "All"]],

Example 2: datatable bootstrap cllick on specific button

// https://stackoverflow.com/a/32475592/3673842

// html
'<button class="my-custom-button btn btn-outline-danger">My custom button</button>'

$('#table-id tbody').on( 'click', 'button.my-custom-button', function () {
  alert(alert($(this).text())) // will display "My custom button"
})

Tags:

Html Example