Update: the documentation now states that
lookup.filter replaces the lookup's own filter, and what that means with server-side search. Fixed in
WUIC Framework 1.8.2 .
The original answer below describes versions before 1.8.2.QuestionI have a
lookupByID column with
mc_serverside_operations enabled. I added a
lookup.filter in
mc_props_bag to show only active records, and now typing in the autocomplete no longer narrows the list. Is this a bug?
AnswerNo, it is how the override works:
lookup.filter replaces 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
contains filter on the field set in
mc_ui_lookup_dataTextField and re-queries the lookup route. If
field.extras.lookup.filter 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.
What to do- If the filtered list is small, turn off
mc_serverside_operations. The items are loaded once with your filter and the typed text is matched locally, with the match mode set in mc_ui_lookup_filter. Keep mc_ui_pagesize large enough to hold them all. - If the list is large and needs server-side search, don't use
lookup.filter. Point mc_ui_lookup_entity_name at a route that already returns only the records you want.
For reference, this is the block that triggers the behaviour:
{
"lookup": {
"filter": {
"logic": "AND",
"filters": [
{ "field": "is_active", "operatore": "eq", "value": true }
]
}
}
}
Documentation: Field Editor Widgets Edited by user
9 days ago |
Reason: fixed in 1.8.2