Two DataTables in 2 Bootstrap tabs

Two DataTables in 2 Bootstrap tabs

arosnerarosner Posts: 35Questions: 8Answers: 1

I am attempting to populate 2 datatables on the same page, each under a different tab. I get no console errors. The first tab looks ok, but the second tab does not show search textboxes. Instead of search textboxes, the second tab just repeats the header in read/only labels.

I noticed the question, Looks like I am trying to do the same thing.

What are the pertinent parts of the example that I need to implement?

For example, I noticed The following code differences:

1) Added code to document.Ready

$(document).ready(function () {
$('a[data-bs-toggle="tab"]').on('', function (e) {
let current =;
let tabTable = current.hash + 'Table';

if ( ! $.fn.DataTable.isDataTable( tabTable ) ) {
    case "#tab_1Table":
    case "#tab_2Table":
    default: //Lets not do anything if we don't recognize the tab/table


2) Each DataTables function has the following property:
dom: "tr" +

3) Each DataTables initComplete function has the following method call at the end:


4) Some DataTables initComplete functions have a second "wrapper" parameter when accessing a cell (others do not):

                var cell = $('.filters th', '#tab_1Table_wrapper').eq(


                var cell = $('.filters th').eq(


Sign In or Register to comment.