Hiding Columns

Summary

  • AdapTable allows Columns to be defined as Hidden, by setting a type of hiddenColumn in ColDefs
  • Hidden Columns are never visible in the Grid (or the AdapTable UI) but can be used in Expressions

Columns can be hidden in AdapTable so that they are never displayed in the UI.

This is especially useful if you are using a primary key column which you do not want users to see or edit.

Note

This is done setting (or adding) hiddenColumn to the type property in the AG Grid ColdDef definition.

Hint

  • Alternatively you can use the AdaptableColumnType.HiddenColumn constant
  • See the Guide to Providing Column Types for more information of setting column types
// Add 2 hidden columns
export const columnDefs: ColDef<WebFramework>[] = [
  {
    field: 'id',
    cellDataType: 'number'
    type: 'hiddenColumn'
  },
  {
    field: 'map',
    cellDataType: 'text'
    type: AdaptableColumnType.HiddenColumn
  },
]

Caution

  • AG Grid offers a similar ColDef property named hide which if set to true will hide the Column
  • AdapTable ignores this property and sets visibility based purely on Layout properties and the hiddenColumn type
Hiding a Column in AdapTable UI
Fork
  • In this example we "hide" the Github Watchers and Github Stars Columns by setting their ColDef type property to HiddenColumn
  • As a result they are not visible in the Grid, nor in the Columns Tool Panel and nor the Layout Wizard
  • However they are stil available for use in Expression Editor and Query Builder
Try It Out
  • Open Columns Tool Panel and note the Github Watchers and Github Stars Columns are not listed (but the Calculated Column Github Total is listed)
  • Edit the Grid Filter, or the Github Total Calculated Column, and note Github Watchers & Github Stars Columns are referenced in the Expression and available in Expression Editor and Query Builder
  • Note also that we set the Name column with hide in ColDefs but that gets ignored by AdapTable and the column is displayed (as its in the Layout)

Breaking Change

  • Prior to AdapTable 21 fully hidden columns could only be achieved by a combination of 4 ColDef properties
  • These needed explicitly setting to true: hide, lockVisible, suppressColumnsToolPanel, suppressFiltersToolPanel