Dynamic Responsive Toggle
Dynamic Responsive Toggle
Hi all,
I am trying to achieve dynamic toggling of responsiveness of datatables and not sure how do I achieve it.
My use case - In mobile mode, my table shows 2 cols with rest of cols collapsed and shown when clicked on the '+'.
I want to add a button to set datatable setting "responsive:false" along with other scroll options but I'm not sure how I achieve it.
Would be great if I can get someone can point me how to get and change some of the datatables settings, (while keeping the same data and just re-drawing the same table with additional/updated settings).
Thanks in advance.
Answers
I don't see a Responsive API to enable/disable it. In order to change most Datatable options like scrolling you will need to destroy the Datatable and reinitialize it with the desired options. The
destroy()
API can be used for this.Kevin
One thing you could try is add class
never
to the column header, then callresponsive.rebuild()
, that will effectively disable responsiveness. There's an example of that on therebuild()
page.Colin