How can I get DataTables to work with Bootstrap-Confirmation?
How can I get DataTables to work with Bootstrap-Confirmation?
n403729w735708
Posts: 26Questions: 6Answers: 4
Hi,
Just curious if you have any tips for getting bs-confirmation to work with DataTables. I can get the confirmation button to display in the table. Only, nothing happens when I actually click the button. I don't see any errors in the console. When I placed the button in a basic html table (without using jQuery Datatables), it worked normally. Thanks.
plugin: https://github.com/mistic100/Bootstrap-Confirmation
var table = $('#historyTable').DataTable({
"columnDefs": [
{
"render": function (data, type, row) {
return ' <button type="button"id="example" class="btn btn-danger" data-toggle="confirmation" data-singleton="true" data-popout="true" data-btn-ok-label="Continue" data-btn-ok-icon="glyphicon glyphicon-share-alt" data-btn-ok-class="btn-success" data-btn-cancel-label="Stoooop!" data-btn-cancel-icon="glyphicon glyphicon-ban-circle" data-btn-cancel-class="btn-danger">Confirmation</button>';
},
"targets": 0
}
]
});
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
bump
How are you attaching the event handlers? The event FAQ might be useful for you.
Allan
Tried the following but no response:
$('#example').on('click', function() {
$('#example').confirmation('show');
});
This seems to work:
$('#historyTable tbody').on('click','#example', function () {
$('#example').confirmation('show');
} );