Skip to content

Grid Hidden Column is set as exportable by default for Pdf and Excel #7959

@alestoya

Description

@alestoya

Bug report

Grid Hidden Column is set as exportable by default for Pdf and Excel

Reproduction of the problem

  1. Set a Column as hidden through the Hidden() API configuration.
  2. Add both the ToolBar.Excel() and ToolBar.Pdf() API configurations.
  3. Notice, that the hidden column is exported.

Current behavior

The Grid Hidden Column is set as exportable by default for Pdf and Excel.

Expected/desired behavior

The Grid Hidden Column should NOT be set as exportable by default for Pdf and Excel.

Workarounds

If you wish to set the hidden columns as non-exportable on a global scale, then a possible recommendation would be handle the DataBound event of the Grid and add the following layer of logic:

.Events(events => events.DataBound("onDataBound"))

<script>
    function onDataBound(e){
        var columns = e.sender.columns.filter(column => {
            return column.hidden == true;
        }).forEach(column => column.exportable = false);
    }
</script>

If you wish to set the exportable state of the hidden columns granularly, a possible recommendation would be use the Columns.Bound.Exportable() API configuration.

.Columns(columns =>
{
    columns.Bound(p => p.Freight).Hidden(true).Exportable(false);
    columns.Bound(p => p.OrderDate);
})

Environment

  • Kendo UI version: 2024.3.806
  • Browser: all

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions