Use this file to discover all available pages before exploring further.
The IFilterComp interface allows you to create custom filter components in AG Grid. Filters determine which rows are displayed based on user-defined criteria.
interface IFilterComp<TData = any> extends IComponent<IFilterParams<TData>>, IFilter { /** Returns `true` if the filter is currently active */ isFilterActive(): boolean; /** Returns a model representing the current state of the filter */ getModel(): any; /** Sets the state of the filter using the supplied model */ setModel(model: any): void | AgPromise<void>; /** The grid will ask each active filter if each row passes */ doesFilterPass(params: IDoesFilterPassParams): boolean; /** Optional: Called when new rows are inserted into the grid */ onNewRowsLoaded?(): void; /** Optional: Called whenever any filter is changed */ onAnyFilterChanged?(): void; /** Optional: A hook to perform operations after GUI is rendered */ afterGuiAttached?(params?: IAfterGuiAttachedParams): void; /** Optional: A hook to perform operations after GUI is removed */ afterGuiDetached?(): void; /** Optional: Used for rendering in floating filter */ getModelAsString?(model: any): string;}
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.
onNewRowsLoaded() { // Update available filter values based on other filters const availableValues = new Set(); this.params.api.forEachNode(node => { if (this.params.doesRowPassOtherFilter(node)) { const value = this.params.getValue(node); availableValues.add(value); } }); this.updateFilterOptions(Array.from(availableValues));}
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.
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 question
params.data: The data part of the row node in question
doesFilterPass(params) { const value = this.params.getValue(params.node); return this.selectedValues.includes(value);}
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.