Export data hidden by Responsive whilst avoiding columns hidden by colvis

Export data hidden by Responsive whilst avoiding columns hidden by colvis

CryogenCryogen Posts: 4Questions: 1Answers: 0
edited February 2020 in Free community support

Exporting data hidden by Responsive whilst avoiding columns hidden by colvis

I've been looking in vain for a way to do this since "display: none" is used in both cases. columns: ':visible' neatly excludes the columns hidden by colvis but also misses the columns hidden by Responsive which I want to include. I've tried other selectors, combining options and a few other things but I can't get past exporting either none of the hidden columns or all of them. Is there a way to select the columns i want?

Answers

  • colincolin Posts: 15,144Questions: 1Answers: 2,586

    You can use a function for the exportOptions - and in there call columns.visible(). That function returns true/false based on the colvis visibility, rather than the Responsive behaviour. See example here.

    Colin

  • CryogenCryogen Posts: 4Questions: 1Answers: 0

    Thanks but that link is to something dead. Can you put some information here?

  • kthorngrenkthorngren Posts: 20,302Questions: 26Answers: 4,769

    Here is the correct link to columns().visible(). Did you look at the example Colin posted? I think that will do what you want.

    Kevin

  • CryogenCryogen Posts: 4Questions: 1Answers: 0

    Hi,

    Thanks. Yes but you didn't or you'd have seen that that's what's broken. Obviously I can find the Columns API myself.

    Cheers.

  • kthorngrenkthorngren Posts: 20,302Questions: 26Answers: 4,769

    Yes but you didn't or you'd have seen that that's what's broken

    Colin's link (See example here ) does work. Here is the link:
    http://live.datatables.net/dodumaso/1/edit

    Or, is there something in the example that isn't working?

    Kevin

  • CryogenCryogen Posts: 4Questions: 1Answers: 0

    Hi,

    No, it doesn't. That's the point. Both of those links return:

    Not Found
    
    The requested URL was not found on this server.
    
    Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
    

    Thanks.

  • kthorngrenkthorngren Posts: 20,302Questions: 26Answers: 4,769

    http://live.datatables.net/dodumaso/1/edit

    This works for me, see the screenshot:

    I copied the code to jsfiddle in case you have issues accessing http://live.datatables.net/ in general:
    https://jsfiddle.net/oketunwc/

    Kevin

This discussion has been closed.