Skip to content

Commit

Permalink
form.field.ComboBox: doFilter() => apply selections & list focus depe…
Browse files Browse the repository at this point in the history
…nding on the current value config #6264
  • Loading branch information
tobiu committed Jan 21, 2025
1 parent 491c17a commit e1dfd6b
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/form/field/ComboBox.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
})
Expand Down

0 comments on commit e1dfd6b

Please sign in to comment.