IHeaderComp interface allows you to create custom components for column headers in AG Grid. Header components control how column headers are displayed and can add custom functionality like sorting, filtering, or custom interactions.
Overview
Create custom header components to add specialized header displays, custom sorting controls, or additional header functionality.Interface Definition
IHeaderParams
The column the header is for.
The name to display for the column. If the column is using a headerValueGetter, the displayName will take this into account.
Whether sorting is enabled for the column. Only put sort logic into your header if this is true.
Whether menu is enabled for the column. Only display a menu button in your header if this is true.
Whether filter button should be displayed in the header (for new column menu).
Whether filter icon should be displayed in the header (for legacy tabbed column menu).
The header the grid provides. The custom header component is a child of the grid provided header. This is provided should you want to make changes to this cell, eg add ARIA tags, or add keyboard event listener.
Callback Methods
Callback to request the grid to show the column menu. Pass in the html element of the column menu button to have the grid position the menu over the button.
Callback to request the grid to show the column menu. Similar to
showColumnMenu, but will position the menu next to the provided mouseEvent.Callback to request the grid to show the filter. Pass in the html element of the filter button to have the grid position the menu over the button.
Callback to progress the sort for this column. The grid will decide the next sort direction eg ascending, descending or ‘no sort’. Pass
multiSort=true if you want to do a multi sort (eg user has Shift held down when they click).Callback to set the sort for this column. Pass the sort direction to use ignoring the current sort. Pass
multiSort=true if you want to do a multi sort.Sets a tooltip to the main element of this component.Module:
TooltipModuleTemplate Properties
Custom header template if provided to
headerComponentParams, otherwise will be undefined.The component to use for inside the header (replaces the text value and leaves the remainder of the Grid’s original component).
Required Methods
Get the header to refresh. Gets called whenever Column Defs are updated. Return
true if the refresh was successful, false if not (then grid will destroy and recreate the component).Complete Example
Header Templates
You can also provide a simple HTML template for the header:Related APIs
Column Definitions
Configure header components in columns
Column Events
Header interaction events
GridApi
Programmatic column control