How to disable/enable Responsive on the fly
How to disable/enable Responsive on the fly
Hello,
I was wondering if it was possible to disable Responsive after it is called, and then re-enable it? I want to use Responsive for certain browser widths, but at a certain breakpoint I would like to use my own custom method of styling the table, so I will need some way to force all the columns to be visible again. Is this possible? I am using the most recent DataTables (10.5) with the "responsive" class. Removing the class and calling table.responsive(false) after the table has initialized doesn't seem to work.
I don't think a working example is needed in this case -- let me know if posting one would help. Many thanks.
This question has an accepted answers - jump to answer
Answers
Using some jQuery to detect the window width, I tried to add/remove the class "all". At first I thought this worked, but alas the columns keep disappearing.
To unhide the columns that are already hidden, I just call:
If I can figure out a way to halt responsive from making the columns disappear after a certain breakpoint, then I'll have a complete solution.
I realize I'm talking to myself, but I'm learning as I go, so please bear with me.
Here is my solution, as clunky as it may be.
FIrst, I set a variable in the document:
Then, after the table is initialized:
Then, inside responsive.js:
Currently no there is no enable / disable option for Responsive. You would need to use a hack as you have.
Allan