Is it possible to have a class and an ID on a table without "Cannot reinitialise Datatable" error
Is it possible to have a class and an ID on a table without "Cannot reinitialise Datatable" error
I have a site that has multiple tables all of which have the display class. For obvious reasons this is good so if you make one change it up dates them all etc.
But I want to Ajax in the data, but this involves adding an ID or another class to add the ajax source into the Datatable call. Which means I would have to make changes in a lot of places for even the simplest of things.
If I have both, say the display class to set which buttons they have and page length options etc. Then an ID of example to just handle the Ajax call I get the "Cannot reinitialise DataTable" Error.
Is there a clever way to achieve this? To have one main class that all my tables run off for style and set up but also be able to access each one individually for the Ajax request?
Any input is appreciated.
This question has an accepted answers - jump to answer
Answers
I think this might be a good use case for using HTML5 data-* attributes to set options.
Allan