3

I am trying to customize the columnsMenuTab display in ag-grid to hide certain group header rows from being shown. We have a column group hierarchy that looks something like:

Name
  Type Name
    Formula
      Column Name

We'd like to hide the Formulas from being displayed inside the columnsMenuTab so that when the user is toggling the column visibility they don't see the formulas but they can still see the column name. The end result would be something like:

Name
  Type Name
      Column Name

Looking through the documentation (https://www.ag-grid.com/javascript-grid-column-menu/) I was not able to find a way to achieve this customization.

We are using ag-grid-react (enterprise) 21.0.1

Thanks.

05/18 Edit: Added some clarification as to the end result.

sdev001
  • 31
  • 3

2 Answers2

2

You can use suppressColumnsToolPanel: true for the column you dont want to show up in columnsMenuTab as well as the tool panel that shows up on the right.

This works for column or column group in the hierarchy and should work for Formula column in your case.

As per docs-

suppressColumnsToolPanel Set to true if you do not want this column or group to appear in the Columns Tool Panel. Default: false

Pratik Bhat
  • 7,166
  • 2
  • 35
  • 57
  • The option suppresses the column from the column tool panel, not the column menu accessible by clicking on the menu in the column header. – sdev001 May 18 '20 at 18:07
  • I have tried this option and it works for me in both places. Strange why it doesn’t work for you – Pratik Bhat May 18 '20 at 18:18
  • I'll try creating a plunker with an example see if that helps. In the meantime, which version of ag-grid were you testing in? – sdev001 May 20 '20 at 13:22
  • I tried with the latest version and based on a plunker off ag grid site’s example – Pratik Bhat May 20 '20 at 13:30
  • I tried with the latest version and that removed it from both, seems it doesn't work in the version I currently use (21.0.1). However, it's not quite what I'm looking for. If I add the setting to the formula header it hides all it's children as well (the column names). – sdev001 May 27 '20 at 13:36
0

Still works in @ag-grid-community/core@^28.1.1 @ag-grid-enterprise/column-tool-panel@^28.1.1 I set suppressColumnsToolPanel: true on one of the columns and this column does not appear in the column menu > column selection tab anymore.