listner beforequery を使用してコンボボックスをフィルタリングしています。フィルタリング中はすべて問題ありませんが、次のような問題に直面しています。
フィルタするためにコンボボックスに目的の文字を入力すると、それらは自動的に選択されます..新しい文字を入力したい場合は、右側の矢印を押して選択を解除するか、残りの文字を削除する必要があります...この動作の理由を教えてください.
コード:
xtype: 'combo',
fieldLabel: 'Label',
anchor: '100%',
enableKeyEvents: true,
allowBlank: false,
displayField: 'value',
store: 'level1Store',
lazyInit: false,
mode: 'local',
forceSelection: true,
disableKeyFilter: true,
editable: true,
triggerAction: 'all',
valueField: 'key',
name: 1,
ref: 'combo1',
id: 'field1'
フィルタリングするリスナー コード:
Ext.getCmp('field1').addListener({
beforequery: function (e) {
if (e.query && e.query.indexOf('?') != -1) {
e.cancel = true;
var query = new RegExp(String.format('^{0}', e.query.replace(/\?/g, '[A-Za-z0-9]')));
this.onLoad();
this.store.clearFilter(true);
this.store.filter(this.displayField, query);
}
}
});