fix comboBox validation when forceSelection is true

Prevent the comboBox from displaying a validation error although
forceSelection is true. If you change a valid selection by removing
characters manually and click somewhere else, the comboBox restores
the selection with the previous value. The validation logic then
checked the restored value, but couldn't find it in the store,
because the store is still filtered with the erroneous query.

We now clear the local filter before the actual check to prevent
this.

[Thomas]:
This was fixed in the 6.2 based GPL release of ExtJS, and can be seen
as backport.

Signed-off-by: Tim Marx <t.marx@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Tim Marx 2019-10-25 13:06:08 +02:00 committed by Thomas Lamprecht
parent 23446ca9f2
commit 35eec238b2

View File

@ -310,6 +310,18 @@ Ext.define('Proxmox.form.ComboGrid', {
return picker;
},
clearLocalFilter: function() {
var me = this,
filter = me.queryFilter;
if (filter) {
me.queryFilter = null;
me.changingFilters = true;
me.store.removeFilter(filter, true);
me.changingFilters = false;
}
},
isValueInStore: function(value) {
var me = this;
var store = me.store;
@ -319,6 +331,13 @@ Ext.define('Proxmox.form.ComboGrid', {
return found;
}
// Make sure the current filter is removed before checking the store
// to prevent false negative results when iterating over a filtered store.
// All store.find*() method's operate on the filtered store.
if (me.queryFilter && me.queryMode === 'local' && me.clearFilterOnBlur) {
me.clearLocalFilter();
}
if (Ext.isArray(value)) {
Ext.Array.each(value, function(v) {
if (store.findRecord(me.valueField, v)) {