From e1dfd6ba7e1f57d6353dd962f5500199005f02f0 Mon Sep 17 00:00:00 2001 From: tobiu Date: Tue, 21 Jan 2025 18:34:51 +0100 Subject: [PATCH] form.field.ComboBox: doFilter() => apply selections & list focus depending on the current value config #6264 --- src/form/field/ComboBox.mjs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/form/field/ComboBox.mjs b/src/form/field/ComboBox.mjs index 337981f3c..c2ebf26ea 100644 --- a/src/form/field/ComboBox.mjs +++ b/src/form/field/ComboBox.mjs @@ -395,9 +395,10 @@ class ComboBox extends Picker { * @param {String|null} value The value to filter the picker by */ doFilter(value) { - let me = this, - {picker, record, store} = me, - filter = store.getFilter(me.displayField); + let me = this, + {picker, store} = me, + record = me.value, + filter = store.getFilter(me.displayField); if (filter) { filter.value = value @@ -408,7 +409,7 @@ class ComboBox extends Picker { me.showPicker(); // List might not exist until the picker is created - let {list } = me, + let {list} = me, {selectionModel} = list; // On show, set the active item to be the current selected record or the first @@ -420,7 +421,8 @@ class ComboBox extends Picker { } me.timeout(100).then(() => { - const index = store.indexOf(record); + let index = store.indexOf(record); + list._focusIndex = -1; // silent update to ensure afterSetFocusIndex() always gets called list.focusIndex = index > -1 ? index : 0 })