Open bmblb opened 4 days ago
I think the fix in Combo.js
is
/**
* Clears the value of this Field, and triggers the {@link #event-clear} event.
*/
clear(event) {
const
me = this,
{ value } = me;
// input.value may be null. Custom input elements may have non-string values
// and may be cleared to null
if (value !== me.nullValue || me.input.value) {
me.value = me._lastValue = me.nullValue;
me.clearError();
me.syncInvalid();
// event will be present if called from the clearTrigger click
me.trigger('clear', { event });
}
}
The issue was that the _lastValue
property is supposed to be a temporary "placeholder" value which is returned as the field's value if an invalid, unmatched in the store value is set, or if a value has been set while an AjaxStore has not loaded.
It gets cleared upon arrival of a valid value.
Clearing the field is setting a valid value, so clear _lastValue
there too, before clearing the value.
Reported here: https://forum.bryntum.com/viewtopic.php?f=43&t=30944&p=157181#p157181
To reproduce use this combo box config:
When you click the clear toggle, first click does nothing. Second clears the input value
UPD: also smth to look at
When we set value which does not exist in the combo, only onChange is triggered. If a value from the store is selected both onChange and onSelect are triggered.