The Filter Connection Manager is used to manage the filter associations between filter forms (FilterForm) and data blocks (tables, lists, charts, etc.). It is provided by BlockGridModel and is only available within its context (e.g., filter form blocks, data blocks).
| Scenario | Description |
|---|---|
| Filter Form Block | Manages connection configurations between filter items and target blocks; refreshes target data when filters change. |
| Data Block (Table/List) | Acts as a filter target, binding filter conditions via bindToTarget. |
| Linkage Rules / Custom FilterModel | Calls refreshTargetsByFilter within doFilter or doReset to trigger target refreshes. |
| Connection Field Configuration | Uses getConnectFieldsConfig and saveConnectFieldsConfig to maintain field mappings between filters and targets. |
Note:
ctx.filterManageris only available in RunJS contexts that have aBlockGridModel(e.g., within a page containing a filter form); it isundefinedin regular JSBlocks or independent pages. It is recommended to use optional chaining before access.
| Method | Description |
|---|---|
getFilterConfigs() | Gets all current filter connection configurations. |
getConnectFieldsConfig(filterId) | Gets the connection field configuration for a specific filter. |
saveConnectFieldsConfig(filterId, config) | Saves the connection field configuration for a filter. |
addFilterConfig(config) | Adds a filter configuration (filterId + targetId + filterPaths). |
removeFilterConfig({ filterId?, targetId?, persist? }) | Removes filter configurations by filterId, targetId, or both. |
bindToTarget(targetId) | Binds the filter configuration to a target block, triggering its resource to apply the filter. |
unbindFromTarget(targetId) | Unbinds the filter from the target block. |
| `refreshTargetsByFilter(filterId | filterId[])` |
getFilterValue() to return the current filter value.resource must support addFilterGroup, removeFilterGroup, and refresh.