editable: false,
+ triggers: {
+ clear: {
+ cls: 'pmx-clear-trigger',
+ weight: -1,
+ hidden: true,
+ handler: function() {
+ var me = this;
+ me.setValue('');
+ }
+ }
+ },
+
+ setValue: function(value) {
+ var me = this;
+ me.triggers.clear.setVisible(!!value && me.allowBlank);
+ return me.callParent([value]);
+ },
+
// override ExtJS method
// if the field has multiSelect enabled, the store is not loaded, and
// the displayfield == valuefield, it saves the rawvalue as an array
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;
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)) {
return true; // handled later by allowEmpty in the getErrors call chain
}
+ // we normally get here the displayField as value, but if a valueField
+ // is configured we need to get the "actual" value, to ensure it is in
+ // the store. Below check is copied from ExtJS 6.0.2 ComboBox source
+ //
+ // we also have to get the 'real' value if the we have a mulitSelect
+ // Field but got a non array value
+ if ((me.valueField && me.valueField !== me.displayField) ||
+ (me.multiSelect && !Ext.isArray(value))) {
+ value = me.getValue();
+ }
+
if (!(me.notFoundIsValid || me.isValueInStore(value))) {
return gettext('Invalid Value');
}