| Posted by: WUICTeam - Wednesday, November 4, 2026 9:02:01 AM |
|---|
| [b]Update:[/b] the documentation now states that [c]lookup.filter[/c] replaces the lookup's own filter, and what that means with server-side search. Fixed in [url=https://wuic-framework.com/downloads/release-notes#v1.8.2]WUIC Framework 1.8.2[/url]. [i]The original answer below describes versions before 1.8.2.[/i] [b]Question[/b] I have a [c]lookupByID[/c] column with [c]mc_serverside_operations[/c] enabled. I added a [c]lookup.filter[/c] in [c]mc_props_bag[/c] to show only active records, and now typing in the autocomplete no longer narrows the list. Is this a bug? [b]Answer[/b] No, it is how the override works: [c]lookup.filter[/c] [i]replaces[/i] the filter the widget would build itself, it is not added to it. In server-side mode, when the user types, the lookup editor normally builds a [c]contains[/c] filter on the field set in [c]mc_ui_lookup_dataTextField[/c] and re-queries the lookup route. If [c]field.extras.lookup.filter[/c] is present, that filter is assigned to the lookup datasource instead, so every keystroke re-runs the same fixed query and the typed text never reaches the server. The same replacement applies to the fetch-by-id the widget does when the foreign key is set programmatically and the value is not among the loaded items: your filter is used instead of the id filter, so a value excluded by your filter will not resolve to its description. [b]What to do[/b] [list] [*]If the filtered list is small, turn off [c]mc_serverside_operations[/c]. The items are loaded once with your filter and the typed text is matched locally, with the match mode set in [c]mc_ui_lookup_filter[/c]. Keep [c]mc_ui_pagesize[/c] large enough to hold them all. [*]If the list is large and needs server-side search, don't use [c]lookup.filter[/c]. Point [c]mc_ui_lookup_entity_name[/c] at a route that already returns only the records you want. [/list] For reference, this is the block that triggers the behaviour: [code] { "lookup": { "filter": { "logic": "AND", "filters": [ { "field": "is_active", "operatore": "eq", "value": true } ] } } } [/code] [url=https://wuic-framework.com/docs/field-editor-widgets]Documentation: Field Editor Widgets[/url] |