Can DataTables be integrated into a table in a Bootstrap modal ?

Can DataTables be integrated into a table in a Bootstrap modal ?

devcoderdevcoder Posts: 3Questions: 0Answers: 0
edited August 2012 in DataTables 1.9
I have already implemented a datatables wherein I have anchor hyperlinks for one of the columns in each row. Each of these hyperlinks launches a twitter bootstrap modal. In this modal I have another table styled by bootstrap. The table is quite big and there is a lot of scrolling involved. I would like to integrate DataTables into this table in the modal box. I get the table for the modal table through AJAX and the code looks like this

[code]

$('.dropdown-toggle').dropdown();
$('#myModal').modal('hide');
$('#myModal').on('shown', function(){
var vendor = $(this).data('vendor');

$.ajax({
type: "GET",
url: "iprange.php",
data: "?id=" + vendor,
success: function(html){
$("#modal-body").html(html);
}
});

});

[/code]

Replies

  • allanallan Posts: 63,455Questions: 1Answers: 10,465 Site admin
    Yes, I don't see a problem with putting a DataTable inside a modal (indeed, I've seen it done many times). Just initialise the DataTable after you write the HTML.

    Allan
This discussion has been closed.