problem displaying several Datatables on one page

problem displaying several Datatables on one page

veloopityveloopity Posts: 87Questions: 36Answers: 2
edited February 2022 in DataTables 1.10

I've made a search result page that displays three different kinds of search results, differently structured, from different database tables. To make it more user friendly, I've put each of the 3 results into its own Datatable, and I've used a simple javascript tab control so that the user can switch between them, displaying one while the others are invisible. (I have only realized this for 2 of the 3 so far but ran into a problem.)
The datatables (the table IDs) have different names of course. Because I include code parts, there are two independent initializations with different names: $('#table1').DataTable() and $('#table2').DataTable() (with various settings).
Problem:
The first datatable that gets displayed works ok (I can programmatically set the first or the second one to be the first one displayed, and I can say that each of them works ok). Then when I switch to the other one, it looks ok at first sight but the controls (filter, pagination) no longer react. And when I switch back to the other one, the Datatables formatting is gone.
There are no errors in the browser console.
I've seen the demo page with two tables so it should theoretically work but I have no idea what is wrong. If necessary, I could write a test program.

This question has an accepted answers - jump to answer

Answers

Sign In or Register to comment.