KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

DataGrid column visibility does not affect print, PDF, Excel, or CSV exports. #3434

Open iWorQ Systems opened this topic on 4 days ago - 1 comments

iWorQ Systems commented 4 days ago

After changing the column visibility, the columns that were hidden are still showing up in the export. Is there a way that when they click on those buttons the column visibility options stick?

Below are photos showing us removing the Total Cost column, but still showing up in the Print.

Sebastian Morales commented 2 days ago

You can config DataTables' column visible, print and other client export plugin buttons like the following to print/export only visible columns:

    DataTables::create(array(
        ...
        "options" => array(
            "buttons" => [
                [
                    "extend" => 'excel',
                    "exportOptions" => [
                        "columns" => ':visible' // Only export visible columns
                    ]
                ],
                [
                    "extend" => 'print',
                    "exportOptions" => [
                        "columns" => ':visible' // Only print visible columns
                    ]
                ],
                'colvis' // Add column visibility control
            ]
        ), 

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
None yet

DataGrid