Filtering
All four filtering surfaces on one grid: type in the filter row (click the operator button to switch Contains → Starts with → …), open a header filter and search inside its values, use the global search (matches are highlighted), or click the filter panel at the top to open the Filter Builder for arbitrary and/or trees.
import { ChangeDetectionStrategy, Component, signal } from '@angular/core';
import { OgeColumn, OgeGrid } from '@oge-ui/grid';
import type { FilterExpr } from '@oge-ui/core';
@Component({
selector: 'demo-root',
imports: [OgeColumn, OgeGrid],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<!-- filterRow — per-column editors + operator menu
headerFilter — distinct values with a search box
searchPanel — global search + highlighting
filterPanel — filter builder entry point
filterValue — programmatic and/or tree -->
<oge-grid [data]="employees" keyField="id"
[filterRow]="true"
[headerFilter]="true"
[searchPanel]="true"
[filterPanel]="true"
[(filterValue)]="filter">
<oge-column field="firstName" caption="First Name" />
<oge-column field="salary" caption="Salary" dataType="number" />
</oge-grid>
`,
})
export class Demo {
readonly employees = [
{ id: 1, firstName: 'Ali', lastName: 'Yılmaz', department: 'Engineering', city: 'İstanbul', salary: 8400, hireDate: '2019-03-11' },
{ id: 2, firstName: 'Ayşe', lastName: 'Kaya', department: 'Sales', city: 'Ankara', salary: 7200, hireDate: '2020-07-02' },
{ id: 3, firstName: 'Mehmet', lastName: 'Demir', department: 'Engineering', city: 'İzmir', salary: 9100, hireDate: '2018-01-23' },
{ id: 4, firstName: 'Zeynep', lastName: 'Şahin', department: 'Finance', city: 'İstanbul', salary: 6800, hireDate: '2021-11-15' },
{ id: 5, firstName: 'Emre', lastName: 'Çelik', department: 'Support', city: 'Bursa', salary: 5400, hireDate: '2022-05-09' },
];
// filterValue is a serializable and/or expression tree
protected readonly filter = signal<FilterExpr | null>({
type: 'and',
operands: [
{ type: 'binary', field: 'department', op: 'eq', value: 'Engineering' },
{ type: 'binary', field: 'salary', op: 'ge', value: 60000 },
],
});
}Excel-style filter menu
headerFilter.mode picks what the funnel opens: 'list' (the default value checklist with search and select-all), 'conditions' (two operator + value conditions joined by And / Or) or 'both'. Date columns list their values as a collapsible year → month → day tree. The conditions are stored as a filter expression, so they persist with stateKey.
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { OgeColumn, OgeGrid } from '@oge-ui/grid';
@Component({
selector: 'demo-root',
imports: [OgeColumn, OgeGrid],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<!-- mode 'both': two conditions (And / Or) above the value list;
a date column lists its values as a year → month → day tree -->
<oge-grid [data]="employees" keyField="id"
[headerFilter]="{ mode: 'both' }">
<oge-column field="firstName" caption="First Name" />
<oge-column field="salary" caption="Salary" dataType="number" />
<oge-column field="hireDate" caption="Hired" dataType="date" />
</oge-grid>
`,
})
export class Demo {
readonly employees = [
{ id: 1, firstName: 'Ali', lastName: 'Yılmaz', department: 'Engineering', city: 'İstanbul', salary: 8400, hireDate: '2019-03-11' },
{ id: 2, firstName: 'Ayşe', lastName: 'Kaya', department: 'Sales', city: 'Ankara', salary: 7200, hireDate: '2020-07-02' },
{ id: 3, firstName: 'Mehmet', lastName: 'Demir', department: 'Engineering', city: 'İzmir', salary: 9100, hireDate: '2018-01-23' },
{ id: 4, firstName: 'Zeynep', lastName: 'Şahin', department: 'Finance', city: 'İstanbul', salary: 6800, hireDate: '2021-11-15' },
{ id: 5, firstName: 'Emre', lastName: 'Çelik', department: 'Support', city: 'Bursa', salary: 5400, hireDate: '2022-05-09' },
];
}Filter chips and column summaries
filterChips shows every filter that narrows the rows as a removable chip — Column · operator · value — with a clear-all button; removing a chip also empties its editor. summaryMenu adds a Summary submenu to the header context menu (right-click a header): Count for any column, Sum / Avg / Min / Max for numbers. The pick persists with the grid state. In a value list, empty and missing values are one (Blank) item.
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { OgeColumn, OgeGrid } from '@oge-ui/grid';
@Component({
selector: 'demo-root',
imports: [OgeColumn, OgeGrid],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<!-- filterChips: one removable chip per active filter, plus "Clear all".
summaryMenu: right-click a header → Summary → Count / Sum / Avg / Min / Max;
the pick is part of state() and is computed over the filtered set -->
<oge-grid [data]="employees" keyField="id"
[filterRow]="true" [headerFilter]="true" [searchPanel]="true"
[filterChips]="true" [summaryMenu]="true">
<oge-column field="firstName" caption="First Name" />
<oge-column field="city" caption="City" />
<oge-column field="salary" caption="Salary" dataType="number" totalSummary="sum" />
</oge-grid>
`,
})
export class Demo {
readonly employees = [
{ id: 1, firstName: 'Ali', lastName: 'Yılmaz', department: 'Engineering', city: 'İstanbul', salary: 8400, hireDate: '2019-03-11' },
{ id: 2, firstName: 'Ayşe', lastName: 'Kaya', department: 'Sales', city: 'Ankara', salary: 7200, hireDate: '2020-07-02' },
{ id: 3, firstName: 'Mehmet', lastName: 'Demir', department: 'Engineering', city: 'İzmir', salary: 9100, hireDate: '2018-01-23' },
{ id: 4, firstName: 'Zeynep', lastName: 'Şahin', department: 'Finance', city: 'İstanbul', salary: 6800, hireDate: '2021-11-15' },
{ id: 5, firstName: 'Emre', lastName: 'Çelik', department: 'Support', city: 'Bursa', salary: 5400, hireDate: '2022-05-09' },
];
}Filter tools
headerFilter.auto puts the value list only on columns whose values repeat (Department, City). Salary filters with a range slider (filterRange), Department with a custom cell (ogeFilterCellTemplate / renderFilterCell). Open the Hired funnel for the quick dates (dateFilterPresets). filterApplyMode: 'manual' holds every edit until Apply filters, and Views (savedViews) saves and reopens named states.
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { OgeColumn, OgeFilterCellTemplate, OgeGrid } from '@oge-ui/grid';
@Component({
selector: 'demo-root',
imports: [OgeColumn, OgeFilterCellTemplate, OgeGrid],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<!-- auto value lists, a range slider, a custom filter cell, quick dates,
manual apply and saved views (stored under stateKey) -->
<oge-grid [data]="employees" keyField="id" stateKey="filter-tools"
[filterRow]="true" [headerFilter]="{ auto: true }"
[dateFilterPresets]="true" filterApplyMode="manual" [savedViews]="true">
<oge-column field="firstName" caption="First Name" />
<oge-column field="department" caption="Department">
<select *ogeFilterCellTemplate="let value; setValue as set"
aria-label="Filter Department"
[value]="value ?? ''" (change)="set($any($event.target).value)">
<option value="">Any</option>
<option>Engineering</option>
<option>Sales</option>
</select>
</oge-column>
<oge-column field="city" caption="City" />
<oge-column field="salary" caption="Salary" dataType="number"
[filterRange]="{ min: 30000, max: 150000, step: 5000 }" />
<!-- a column may ask for its list: the date presets live in its menu -->
<oge-column field="hireDate" caption="Hired" dataType="date" [headerFilter]="true" />
</oge-grid>
`,
})
export class Demo {
readonly employees = [
{ id: 1, firstName: 'Ali', lastName: 'Yılmaz', department: 'Engineering', city: 'İstanbul', salary: 8400, hireDate: '2019-03-11' },
{ id: 2, firstName: 'Ayşe', lastName: 'Kaya', department: 'Sales', city: 'Ankara', salary: 7200, hireDate: '2020-07-02' },
{ id: 3, firstName: 'Mehmet', lastName: 'Demir', department: 'Engineering', city: 'İzmir', salary: 9100, hireDate: '2018-01-23' },
{ id: 4, firstName: 'Zeynep', lastName: 'Şahin', department: 'Finance', city: 'İstanbul', salary: 6800, hireDate: '2021-11-15' },
{ id: 5, firstName: 'Emre', lastName: 'Çelik', department: 'Support', city: 'Bursa', salary: 5400, hireDate: '2022-05-09' },
];
}Display values and Turkish sorting
The search box and the Name filter match what the cells show: leave finds the Status label behind code 1 (a static lookup), ada k finds a full name built by calculateFilterValue. Sort City: sorting.locale: 'tr' puts Isparta (dotless I) before İnegöl, where an English sort would not. On a server source, filterField sends a column's filters under another field.
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { OgeColumn, OgeGrid } from '@oge-ui/grid';
interface Person {
id: number;
firstName: string;
lastName: string;
status: number;
city: string;
}
@Component({
selector: 'demo-root',
imports: [OgeColumn, OgeGrid],
changeDetection: ChangeDetectionStrategy.OnPush,
template: `
<!-- search and filters match what the cells show; text sorts the Turkish way -->
<oge-grid [data]="people" keyField="id" [filterRow]="true" [searchPanel]="true"
[sorting]="{ locale: 'tr' }">
<oge-column field="name" caption="Name"
[calculateCellValue]="fullName" [calculateFilterValue]="fullName" />
<oge-column field="status" caption="Status"
[lookup]="{ dataSource: statuses, valueExpr: 'value', displayExpr: 'text' }" />
<oge-column field="city" caption="City" />
<!-- a server filters a derived column on another field:
<oge-column field="customerName" filterField="customer.lastName" /> -->
</oge-grid>
`,
})
export class Demo {
readonly statuses = [
{ value: 0, text: 'Active' },
{ value: 1, text: 'On leave' },
{ value: 2, text: 'Former' },
];
readonly people: Person[] = [
{ id: 1, firstName: 'Ada', lastName: 'Kaya', status: 0, city: 'İzmir' },
{ id: 2, firstName: 'Can', lastName: 'Işık', status: 1, city: 'Iğdır' },
{ id: 3, firstName: 'Ece', lastName: 'Öz', status: 2, city: 'Isparta' },
];
readonly fullName = (row: Person) => `${row.firstName} ${row.lastName}`;
}Notes
- Open the Hire Date header filter: date values are grouped into a year tree — the year checkbox toggles all its dates at once and the search box matches years or single dates.
- Every surface produces the same serializable
FilterExprtree — combined with AND and sent to your backend unchanged in remote mode. What each operator means, blank cells included, is the filter contract; its JSON test vectors let a server prove it returns the same rows. - A value list cascades like Excel's: it lists the values left by the other columns' filters and the search text, ignoring the column's own selection. On a server source the list's search box asks
distinct()again 250 ms after typing stops. - "Is blank" matches null, empty and whitespace-only cells, and "does not equal" or "not on that day" keep blank rows.
- The operator button in each filter cell offers dataType-appropriate operators; Reset returns to the column default.
[(filterValue)]is two-way: set it programmatically, read what the builder produced, persist it — it also participates instateKey.- Search highlighting only touches default cells; custom
*ogeCellTemplatecontent is never rewritten.