Client Row Label Filters
Learn how to use row label filters to display only row groups with valid labels.
Label filters are specialized filters that are used only when row grouping is enabled on the client row source. For additional details on row grouping, refer to the Client Row Grouping guide.
Label Filter Function
The LyteNyte Grid client data source accepts an array of LabelFilter functions or
null values. The array index maps to a group depth: element
n is applied at depth n. If an element is null, the client data
source skips label filtering at that depth.
The demo shows label filters in action. Click a pill to exclude that label from the grid. Each pill row maps to a group level:
- The Job pill row filters job groups.
- The Education pill row filters education groups.
The demo below shows label filters in action. Clicking a pill disables that label in the grid. The pills are arranged in rows to represent the grouping level. For example, the Job pills filter labels in the job grouping, and the Education pills filter labels in the education grouping.
Row Label Filters
The demo scans pills to identify inactive items. For each grouping level that includes inactive pills, it creates label filters to remove rows with those labels. This is shown in the code below.
For more on pill manager functionality, see the Pill Manager guide.
const labelFilter = useMemo(() => { const filters: (Grid.T.LabelFilter | null)[] = [];
for (const pillRow of pills) { const inactive = new Set(pillRow.pills.filter((x) => !x.active).map((x) => x.id)); if (inactive.size === 0) { filters.push(null); continue; } else { filters.push((s) => !inactive.has(s as string)); } }
return filters;}, [pills]);Next Steps
- Client Row Filtering: Explore how to filter rows when using the client row source.
- Client Row Having Filters: Use client-side filters to exclude rows after row grouping.
- Pill Manager: Create and manage grid interactions using label pills.
- Client Row Grouping: Create a hierarchical representation of your data by grouping rows.
