GRID FEATURE
Filter by business conditions
Connect business conditions outside the Grid through a row predicate. Use this when external UI choices, such as incomplete items or items assigned to you, control the table.
How it works and when to use it
The Grid cannot automatically detect changes to external condition variables. Call refreshExternalFilter to recalculate.
In the code, grid is the Grid element prepared in the installation chapter. Check each example's data and settings, and implement the app functions and server endpoints for your project.
Example 1. Show only large-quantity orders
Connect a business switch that shows quantities of at least 100.
let largeOnly = true;
grid.externalFilter = {
isExternalFilterPresent: () => largeOnly,
doesExternalFilterPass: row => Number(row.quantity) >= 100
};
await grid.refreshExternalFilter();Verify the result: Apply the predicate only when the switch is on. The function must return a boolean without mutating the source row.
Example 2. Clear an external condition
Keep the same filter object and change only the external variable.
largeOnly = false;
await grid.refreshExternalFilter();Verify the result: The external filter is cleared, but column filters and quick search may remain active.
Example 3. Change the app context
When the signed-in user changes, update the user information read by the external filter and recalculate. Lifecycle instances can clean up resources through refresh and destroy.
Verify the result: Conditions from the previous user do not remain. The server must also withhold source values the new user is not authorized to view.
Combining features and troubleshooting
Do not return an asynchronous network response as if it were a boolean predicate. Prepare the required information first, then recalculate the filter.
Conditions requiring a search of the full server data set must also be sent to the server. An external filter cannot derive complete results from loaded client rows alone.
Related reading
- How rows, columns, and IDs relate
- Connect results and events
- Explore in Features
The guide describes which interactions are available to try.