How to invoke datatable on a table inside hidden element?

How to invoke datatable on a table inside hidden element?

LakshmananLakshmanan Posts: 3Questions: 2Answers: 1

I'm having a table inside a div element which is hidden on page load. Based on the user action I will show the div which also contains the datatable. So In my javascript if I invoke the table inside the hidden div, it gives me error in console,

TypeError: $(...).DataTable is not a function
$("#dataTbl").DataTable({

If I set the div to be visible on page load the initialization has no problem. How can I handle this situation?

This question has an accepted answers - jump to answer

Answers

  • LakshmananLakshmanan Posts: 3Questions: 2Answers: 1
    Answer ✓

    The problem was datatables.min.js was not loaded and hence the error message. And whether or not the table is hidden or inside an hidden element the plugin gets initialized.

This discussion has been closed.