Global Filtering Guide
Examples & API
Guide
Filtering comes in 2 flavors: Column Filtering and Global Filtering.
This guide focuses on global filtering, which applies a filter across all columns.
Client-Side vs. Server-Side Filtering
Server-side filtering becomes necessary when datasets are too large to load into the client browser efficiently.
Client-side filtering handles approximately 100,000 rows with acceptable performance for filtering, sorting, pagination, and grouping. See Pagination Guide for detailed performance considerations.
TIP
Client-side operations can handle thousands of rows. Test your specific use case before implementing server-side filtering.
Performance depends on table complexity, column count, and data size. Consider these constraints:
- Server query time and cost
- Fetch payload size
- Client memory consumption
Client-side filtering is sufficient for most tables. Switch to server-side filtering when performance degrades.
Manual Server-Side Global Filtering
Pass pre-filtered data to the table. The getFilteredRowModel option is not needed. Set manualFiltering: true to disable client-side filtering.
// ...
export class ExampleComponent {
table = createAngularTable(() => ({
data: this.data(),
columns,
manualFiltering: true,
}))
}TIP
manualFiltering: true disables client-side filtering logic. The table uses the provided data as-is. Options described in this guide do not apply when manual filtering is enabled.
Client-Side Global Filtering
Pass getFilteredRowModel to the table options:
import {createAngularTable} from "@qualcomm-ui/angular/table"
import {getCoreRowModel, getFilteredRowModel} from "@qualcomm-ui/core/table"
// ...
export class ExampleComponent {
table = createAngularTable(() => ({
getCoreRowModel: getCoreRowModel(),
getFilteredRowModel: getFilteredRowModel(),
}))
}Global Filter Function
The globalFilterFn option specifies the filter function for global filtering. Pass a built-in filter function name, a custom filter function name from tableOptions.filterFns, or a custom filter function.
// ...
export class ExampleComponent {
table = createAngularTable(() => ({
data: this.data(),
columns,
getCoreRowModel: getCoreRowModel(),
getFilteredRowModel: getFilteredRowModel(),
globalFilterFn: "text",
}))
}10 built-in filter functions:
includesString- Case-insensitive string inclusionincludesStringSensitive- Case-sensitive string inclusionequalsString- Case-insensitive string equalityequalsStringSensitive- Case-sensitive string equalityarrIncludes- Item inclusion within an arrayarrIncludesAll- All items included in an arrayarrIncludesSome- Some items included in an arrayequals- Object/referential equality (Object.is/===)weakEquals- Weak object/referential equality (==)inNumberRange- Number range inclusion
Pass custom filter functions directly to globalFilterFn.
Global Filter State
Access the global filter state via table.getState().globalFilter. Manage state externally using Angular signals and the state.globalFilter and onGlobalFilterChange options.
import {signal} from "@angular/core"
// ...
export class ExampleComponent {
globalFilter = signal<string>("")
table = createAngularTable(() => ({
state: {
globalFilter: this.globalFilter(),
},
onGlobalFilterChange: (updaterOrValue) => {
const newFilter =
typeof updaterOrValue === "function"
? updaterOrValue(this.globalFilter())
: updaterOrValue
this.globalFilter.set(newFilter)
},
}))
}Global filter state type:
interface GlobalFilter {
globalFilter: any
}Adding Global Filter Input to UI
The table does not render a global filter input. Add an input element to your template using the QUI TextInputModule:
<q-text-input
placeholder="Search..."
startIcon="Search"
[(ngModel)]="globalFilter"
/>Custom Global Filter Function
Pass a custom filter function to the globalFilterFn option.
TIP
Fuzzy filtering is a common global filter implementation. See Fuzzy Filtering Guide.
const customFilterFn = (rows, columnId, filterValue) => {
return rows.filter((row) => {
// custom filter logic
})
}
// ...
export class ExampleComponent {
table = createAngularTable(() => ({
globalFilterFn: customFilterFn,
}))
}Initial Global Filter State
Set initial state using initialState.globalFilter or by initializing the signal:
// ...
export class ExampleComponent {
globalFilter = signal("search term")
table = createAngularTable(() => ({
initialState: {
globalFilter: "search term",
},
state: {
globalFilter: this.globalFilter(),
},
}))
}WARNING
Do not set globalFilter in both initialState and state. The state option overrides initialState
Disable Global Filtering
Global filtering is enabled by default. Disable it per-column or for all columns using enableGlobalFilter. Set enableFilters: false to disable both column and global filtering.
When disabled, column.getCanGlobalFilter() returns false.
const columns = [
{
header: () => "Id",
accessorKey: "id",
enableGlobalFilter: false,
},
]
// ...
export class ExampleComponent {
table = createAngularTable(() => ({
columns,
enableGlobalFilter: false,
}))
}