2 different dataTables from separate ajax calls
2 different dataTables from separate ajax calls
Hi,
I have a page with a menu list of different data sets. When the user clicks on the data set they want a data Table will popup with all the data for that data set from the DB. I'm running into the issue the first data table works when clicked on but the second one doesn't have any of the dataTables styles or anything. I have 2 separate functions in my code and the functions are called at different times when the user clicks on the menu.
How can I have 2 separate dataTables on one page in different function calls? I looked all over through the forum and couldn't find an answer that worked.
Thanks!
Answers
The two tables need different
id
attributes. What you describe sounds like it should work. Probably need to see your code. Can you create a test case to look at?https://datatables.net/manual/tech-notes/10
Sounds like an error is occurring during the load of the second table. Have you looked at the browser's console for the error?
Kevin
Hi Kevin,
Thanks for the quick response. I did forget to add the error I get when I look in the console.
Uncaught TypeError: Cannot set property '_DT_CellIndex' of undefined
That happens when I click on the second table. The table still loads but it doesn't load any dataTables info.
I've seen this mean that one of the Datatables init options is configured with a non-existent column. If you have four columns then they are columns 0-3.
Kevin