Dynamic Responsive Toggle

Dynamic Responsive Toggle

pranavrpranavr Posts: 1Questions: 1Answers: 0

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

  • kthorngrenkthorngren Posts: 21,169Questions: 26Answers: 4,922

    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

  • colincolin Posts: 15,237Questions: 1Answers: 2,599

    One thing you could try is add class never to the column header, then call responsive.rebuild(), that will effectively disable responsiveness. There's an example of that on the rebuild() page.

    Colin

This discussion has been closed.