Skip to content

BaseFilterPanel

Base class for Angular filter panel components.

Provides a ready-made params input and common lifecycle helpers (applyAndClose, clearAndClose) so consumers only need to implement their filter logic in applyFilter().

import { Component, viewChild, ElementRef } from '@angular/core';
import { BaseFilterPanel } from '@toolbox-web/grid-angular';
@Component({
selector: 'app-text-filter',
template: `
<input #input (keydown.enter)="applyAndClose()" />
<button (click)="applyAndClose()">Apply</button>
<button (click)="clearAndClose()">Clear</button>
`
})
export class TextFilterComponent extends BaseFilterPanel {
input = viewChild.required<ElementRef<HTMLInputElement>>('input');
applyFilter(): void {
this.params().applyTextFilter('contains', this.input().nativeElement.value);
}
}

The grid’s filtering plugin will mount this component and provide params automatically. No manual wiring is required:

gridConfig = {
columns: [
{ field: 'name', filterable: true, filterPanel: TextFilterComponent },
],
};
PropertyTypeDescription
paramsInputSignal<FilterPanelParams>Filter panel parameters injected by the grid’s filtering plugin.

Implement this to apply your filter logic.

Called by applyAndClose before closing the panel. Use this.params() to access the filter API.

applyFilter(): void

Apply the filter then close the panel.

Calls applyFilter followed by params().closePanel(). Bind this to your “Apply” button or Enter key handler.

applyAndClose(): void

Clear the filter then close the panel.

Calls params().clearFilter() followed by params().closePanel(). Bind this to your “Clear” / “Reset” button.

clearAndClose(): void

AI assistants: For complete API documentation, implementation guides, and code examples for this library, see https://raw.githubusercontent.com/OysteinAmundsen/toolbox/main/llms-full.txt