IFilterComp interface allows you to create custom filter components in AG Grid. Filters determine which rows are displayed based on user-defined criteria.
Overview
Create custom filters to provide specialized filtering experiences beyond the built-in text, number, date, and set filters.Interface Definition
IFilterParams
The column this filter is for.
The column definition for the column.
getValue
<TValue = any>(node: IRowNode<TData>, column?: ColKey<TData, TValue>) => TValue | null | undefined
Get the cell value for the given row node and column.
A function callback, call with a node to be told whether the node passes all filters except the current filter. This is useful if you want to only present to the user values that this filter can filter given the status of the other filters.
A function callback to be called when the filter changes. The grid will then respond by filtering the grid data. The callback takes one optional parameter which, if included, will get merged to the FilterChangedEvent object.
A function callback, to be optionally called, when the filter UI changes. The grid will respond with emitting a FilterModifiedEvent.
Required Methods
Returns
true if the filter is currently active, otherwise false. If active then 1) the grid will show the filter icon in the column header and 2) the filter will be included in the filtering of the data.The grid will ask each active filter, in turn, whether each row in the grid passes. If any filter fails, then the row will be excluded from the final set.Parameters:
params.node: The row node in questionparams.data: The data part of the row node in question
Returns a model representing the current state of the filter, or
null if the filter is not active. The grid calls getModel() on all active filters when gridApi.getFilterModel() is called.Sets the state of the filter using the supplied model. Providing
null as the model will de-activate the filter.Optional Methods
Optional: Gets called when new rows are inserted into the grid. If the filter needs to change its state after rows are loaded, it can do it here.
Optional: Called whenever any filter is changed.
Optional: A hook to perform any necessary operation just after the GUI for this component has been rendered on the screen.
Optional: A hook to perform any necessary operation just after the GUI for this component has been removed from the screen.
Optional: Used by AG Grid when rendering floating filters and there isn’t a floating filter associated for this filter.
Complete Example
Built-in Filters
AG Grid provides several built-in filters:'agTextColumnFilter': Text matching filter'agNumberColumnFilter': Number range filter'agDateColumnFilter': Date range filter'agSetColumnFilter': Set/list filter (Enterprise)'agMultiColumnFilter': Combines multiple filters (Enterprise)
Related APIs
Column Definitions
Configure filters in columns
GridApi
Programmatic filter control
Grid Events
Filter-related events