KoolReport's Forum

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

Hide Columns from the Column Visibility when details are used. #3482

Open iWorQ Systems opened this topic on on May 18 - 3 comments

iWorQ Systems commented on May 18

is there a way to hide columns from the column visibility. We have two columns that are added when using details and its causing issues with the Column visibility.

iWorQ Systems commented on May 22

Just checking if you guys have seen this.

Sebastian Morales commented 5 days ago

Sorry for the delay. I think there are 2 solutions for this case:

//javascript
$('#example').DataTable({
    ...
    buttons: [
        {
            extend: 'colvis',
            // Exclude any column with the 'noVis' class
            columns: ':not(.noVis)' 
        }
    ],
    columnDefs: [
        {
            targets: [0], // For example, the first column
            className: 'noVis'
        }
    ]
});

or:

// javascript
buttons: [
    {
        extend: 'colvis',
        // Only show columns 1, 2, 3, 4, and 5 in the menu
        columns: [1, 2, 3, 4, 5] 
    }
]

Pls convert this javascript to PHP array in your DataTables widget. Let us know how they work for you.

iWorQ Systems commented 2 days ago

That worked thank you.

I used the bottom one as

[
    'extend' => 'colvis,
    'columns' => [1,2]
]

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
help needed
solved

DataGrid