diff --git a/_data/components/grid.yml b/_data/components/grid.yml index f0f5d6da1..61662ecb3 100644 --- a/_data/components/grid.yml +++ b/_data/components/grid.yml @@ -10,7 +10,7 @@ inheritedAttributes: [{ },{ component: "OServiceComponent", path: "components/service/service/api", - attributes: ["title", "visible", "enabled", "controls", "detail-mode", "detail-form-route", "recursive-detail", "quick-filter", "quick-filter-placeholder", "quick-filter-appearance", "pagination-controls", "page-size-options","initial-filter-function"] + attributes: ["title", "visible", "enabled", "controls", "detail-mode", "detail-form-route", "recursive-detail", "quick-filter", "quick-filter-placeholder", "quick-filter-appearance", "pagination-controls", "page-size-options","initial-filter-function", "filter-builder-function"] }] attributes: [{ diff --git a/_data/components/list.yml b/_data/components/list.yml index 54756decc..109e25846 100644 --- a/_data/components/list.yml +++ b/_data/components/list.yml @@ -9,7 +9,7 @@ inheritedAttributes: [{ },{ component: "OServiceComponent", path: "components/service/service/api", - attributes: ["title", "visible", "enabled", "controls", "detail-mode", "detail-form-route", "recursive-detail", "detail-button-in-row", "detail-button-in-row-icon", "edit-form-route", "recursive-edit", "edit-button-in-row", "edit-button-in-row-icon", "insert-button", "row-height", "insert-form-route", "recursive-insert", "quick-filter", "quick-filter-placeholder", "quick-filter-appearance", "pagination-controls", "page-size-options","initial-filter-function"] + attributes: ["title", "visible", "enabled", "controls", "detail-mode", "detail-form-route", "recursive-detail", "detail-button-in-row", "detail-button-in-row-icon", "edit-form-route", "recursive-edit", "edit-button-in-row", "edit-button-in-row-icon", "insert-button", "row-height", "insert-form-route", "recursive-insert", "quick-filter", "quick-filter-placeholder", "quick-filter-appearance", "pagination-controls", "page-size-options","initial-filter-function", "filter-builder-function"] }] inheritedOutputs: [{ diff --git a/_data/components/otableData/00table.yml b/_data/components/otableData/00table.yml index c627fd40e..02f6a5aed 100644 --- a/_data/components/otableData/00table.yml +++ b/_data/components/otableData/00table.yml @@ -9,7 +9,7 @@ inheritedAttributes: [{ },{ component: "OServiceComponent", path: "components/service/service/api", - attributes: ["title", "visible", "enabled", "controls", "detail-mode", "detail-form-route", "recursive-detail", "detail-button-in-row", "detail-button-in-row-icon", "edit-form-route", "recursive-edit", "edit-button-in-row", "edit-button-in-row-icon", "insert-button", "row-height", "insert-form-route", "recursive-insert", "filter-case-sensitive", "quick-filter", "quick-filter-placeholder", "pagination-controls", "page-size-options","initial-filter-function"] + attributes: ["title", "visible", "enabled", "controls", "detail-mode", "detail-form-route", "recursive-detail", "detail-button-in-row", "detail-button-in-row-icon", "edit-form-route", "recursive-edit", "edit-button-in-row", "edit-button-in-row-icon", "insert-button", "row-height", "insert-form-route", "recursive-insert", "filter-case-sensitive", "quick-filter", "quick-filter-placeholder", "pagination-controls", "page-size-options","initial-filter-function", "filter-builder-function"] }] attributes: [{ diff --git a/_data/components/service.yml b/_data/components/service.yml index 1d17ce415..cbc1b5cbe 100644 --- a/_data/components/service.yml +++ b/_data/components/service.yml @@ -67,6 +67,11 @@ attributes: [{ type: "() => Expression | { [key: string]: any }", since: "15.8.3", description: "Callback function that returns an initial filter to be applied on every query." +},{ + name : "filter-builder-function", + type: "() => OFilterBuilderComponent", + description: "Callback function that resolves the OFilterBuilderComponent instance", + since: "15.9.0" }] diff --git a/docs/components/o_service_components/01-o-service.component.md b/docs/components/o_service_components/01-o-service.component.md index e8653f057..c1e4850f6 100644 --- a/docs/components/o_service_components/01-o-service.component.md +++ b/docs/components/o_service_components/01-o-service.component.md @@ -74,6 +74,58 @@ initialFilterFunction(): { [key: string]: any } { * **Execution on every query**: The callback is invoked on every request made by the component, including pagination, sorting, and refresh actions. Ensure the function is lightweight and side-effect free. * **Compatibility**: This input is available on all components that extend OServiceComponent, including o-table, o-grid, o-list, and similar data-bound components. +## Filter builder function + +The `filter-builder-function` input allows associating an [`o-filter-builder`](../../data/filterbuilder/overview) +component with any component that extends `OServiceComponent` (such as `o-table`, `o-list`, `o-grid` or `o-data-view`) +when a direct template reference is not possible or when the instance needs to be resolved dynamically at query time. + +This input accepts a callback function with no parameters that returns the `OFilterBuilderComponent` instance to use. +Every time the component performs a data query, it will call this function to retrieve the filter builder and apply +its expression. + +> This approach is an alternative to calling the `setFilterBuilder()` method directly on the component. Use +> `filter-builder-function` when the `o-filter-builder` is defined in a different part of the template, such as +> in a parent component or inside an `o-data-view`. + +**Examples** + +```html + + + + + + + + + + + + + + + + + + + + +``` + +```ts +... + @ViewChild('filterBuilder') filterBuilder: OFilterBuilderComponent; + protected getFilterBuilder = () => this.filterBuilder; +... +``` + + ## Navigation to record detail In the service components, the default action when user clicks a item is to trigger the navigation to its record detail. For changing this behaviour, the user can change the `detail-mode` input value using one of the following values `none`, `click` or `doubleclick`.