How to dynamically active the buttons, filter, info, pagination for a DataTables table element?
How to dynamically active the buttons, filter, info, pagination for a DataTables table element?
I looked and could not find the solution for this. Is it possible to have DataTables create those various elements (buttons, page length, filter, info, pagination) after we added the table element to the DOM? So I initialized my table element (not added to the DOM yet) with $(tableElement).DataTable({ 'data': jsonDataArray, 'columns': [{ 'data': 'ABC', 'title': 'A B C' }] })
. The API does not create those various elements, I added my table element to the DOM. Can I call a method to have DataTables create those various elements? If sot, then I will just have to add the minimalistic table element to the DOM then call .DataTable()
.
Answers
I think I figure it out. Thank you.
Yes, you can do that. The key thought is that you need to insert the table container element, not the table itself. You can get the container using
table().container()
. Here is a little example.Allan