Need to update old code about responsive
Need to update old code about responsive

I need to update this function to work with newest Datatables version.
I don't know why it's no longuer work, any clue ?
function responsiveToggle(dt) {
$(dt.table().header()).find('th').toggleClass('all');
dt.responsive.rebuild();
dt.responsive.recalc();
}
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
What doesn't work?
Can you build a test case to show the problem?
Kevin
Go to https://jsfiddle.net/lenamtl/o8se63fw/
Resize the table so you can see name, office and tools columns then export CSV or Copy. It will export only the visible (from responsive view) columns, not all visible columns from the table.
So I need to export visible column even if they are toggled but I don't want to export real hidden columns.
So to fix that in Datatables 1.10.11 (my fix was working perfectly with this version)
I added this in jquery.dataTables.js just before the function( factory )
Hi,
I tried to reply to this question using lenamtl account and now I'm banned, I don't know why could you fix that thanks
Then i'm using the code like this
then I use it like this
You can't use
:visible
for what you want since Responsive has its column's hidden - i.e. not visible.However, what you can do is make use of the fact that
columns
can be given as a function to test if you want the column to be included or not - e.g.:https://jsfiddle.net/7z6nsgxo/
Allan
Hi @Allan,
This seem to work if I use this, I also need to not export hidden columns
Can you explain why the function I was using does not work anymore?
refer to my question code function responsiveToggle(dt)
Probably just a change between versions broke something. Glad it's working now.
Colin