KoolReport's Forum

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

How do you hide a column in datatable ? #1449

Closed ankit raj opened this topic on on May 18, 2020 - 1 comments

ankit raj commented on May 18, 2020

I bring an extra column in my result array just for some meta data about the row to enable drilldown but i dont want that column to be rendered. how should i hide it? i have tried using columns =>array( .......,"selectedcolumn"=>array("visible"=>false) ) but it doesnt work.
Or is there a better way to pass meta-data for a column which is only used for hidden purposes like click events because even if you hide columns , it will leave vacant space in the UI.

David Winterburn commented on May 20, 2020

If you are using datagrid\DataTables this is a way to hide a column by its order:

DataTables::create(array(
    ...
    "columnDefs" => array(
        array("visible" => false, "targets" => [$colOrder])
    ),

Another method is assigning a css class for the column and set css rule display:none for that class: https://www.koolreport.com/docs/datagrid/datatables/#set-cutom-css-classes

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