Datatable not resizing in Boostrap tabs
Datatable not resizing in Boostrap tabs
VirtualJ
Posts: 2Questions: 2Answers: 0
Hi all
I'm using DT within BS-5 tabs and hit an issue - the DT's aren't resizing when the tab is selected.
I've used this code on other sites and it works fine there - but not on this site.
The console message appears, so the tab is firing as expected, but the table isn't resizing.
Any pointers would be most welcome :-)
$i('a[data-bs-toggle="tab"]').on("shown.bs.tab", function (e) {
console.log( 'show tab' );
$i($i.fn.dataTable.tables(true)).DataTable()
.columns.adjust()
.responsive.recalc();
});
Answers
columns.adjust()
works in this example. Do you havestyle="width:100%"
on the -table
tag as shown. in this example?In order to help debug we will need to see the problem. Please post a link to your page or a test case replicating the issue so we can offer suggestions.
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin