• Resolved baffo2000

    (@baffo2000)


    Is there a Tablepress custom command available so that buttons export only the visible columns to PDF, Excel, etc?

    I know it can be done with Datatables (as this page shows) but I am not sure if or how I can use this JS code in the custom commands box of my Tablepress tables.

    Apologies if this has been posted before, but I have not been able to find the information after a lot of searching.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    thanks for your post, and sorry for the trouble.

    Yes, this should work. First, you could drag the “Custom Commands” box a bit bigger and then add something like what you see on that page:

    "buttons": [
        {
            "extend": "copyHtml5",
            "exportOptions": {
                "columns": [ 0, ":visible" ]
            }
        },
        {
            "extend": "excelHtml5",
            "exportOptions": {
                "columns": ":visible"
            }
        },
        {
            "extend": "pdfHtml5",
            "exportOptions": {
                "columns": [ 0, 1, 2, 5 ]
            }
        },
        "colvis"
    ]
    

    (I recommend to write proper JSON code, with " around the text strings.)

    Regards,
    Tobias

    Thread Starter baffo2000

    (@baffo2000)

    Perfect – this does the exactly the job I wanted. Thank you very much.

    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    no problem, you are very welcome! ?? Good to hear that this helped!

    Best wishes,
    Tobias

    P.S.: In case you haven’t, please rate TablePress here in the plugin directory. Thanks!

    sagirish

    (@sagirish)

    Hi,

    I want only columns 1,2,3,4 to be visible and 1st column to make invisible in the pdf. I wrote the code as below but it made my search bar and pdf button to disappear.
    can you please suggest if i made anything wrong.
    “buttons”: [

    {
    “extend”: “pdfHtml5”,
    “exportOptions”: {
    “columns”: [ 1,2,3,4 ]
    }
    }
    ]

    Thanks
    Sugandha

    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi Sugandha,

    Can you please post a link to the page with the table where this problem happens, so that I can take a direct look? Thanks!

    Regards,
    Tobias

    sagirish

    (@sagirish)

    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    I’m afraid that I can not access that URL, because it’s in the private IP address sector :-/ It’s probably only reachable from your local intranet.

    Regards,
    Tobias

    sagirish

    (@sagirish)

    I did fixed the code. Thanks

    Plugin Author Tobias B?thge

    (@tobiasbg)

    Hi,

    great, good to hear that it’s working now!

    Best wishes,
    Tobias

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Export visible columns only’ is closed to new replies.