View Full Version : [CLOSED][3.x] Ext.form.ComboBox -> lazyInit and store.filter()

10 Jan 2010, 6:18 PM
hi together,

i have build a small showcase:

Ext.onReady(function() {


app.store = new Ext.data.ArrayStore({
fields : ['shortName', 'name']
,idIndex : 0
,data : [
['10' ,'2010']
,['11' ,'2011']
,['12' ,'2012']
,['13' ,'2013']
,['14' ,'2014']

app.win = new Ext.Window({
width : 400
,height : 150
,buttons : [{
text : 'Filter'
,handler : function(){
app.store.filter('shortName', '12');
,items :
app.form = new Ext.form.FormPanel({
labelWidth : 175
,border : false
,items : [
new Ext.form.ComboBox({
allowBlank : false
,lazyInit : false
,forceSelection : true
,store : app.store
,valueField : 'shortName'
,displayField : 'name'
,fieldLabel : 'Year'
,triggerAction : 'all'
,mode : 'local'


when you start the showcase, you will see a window containing a ComboBox and a "Filter"-Button. Since the config "lazyInit" is set to false, the DataView of the ComboBox exists, after the window is shown.

now press the "Filter"-Button without(!) focussing the Combo before. i expected it to reduce the values of the store from 5 to 1. now push the trigger: the lists gets shown with 5 entries. push the button again and it works. from the first time on, the list gets shown, everything is fine.

after looking into the dom further: the 1st push of the filter-button DOES refresh the list, but the first click on the trigger-button refreshes it again and the filtering gets lost.

any ideas why and how to fix / workaround it?

kind regards,

10 Jan 2010, 10:55 PM
ComboBox in mode:'local' uses filtering itself (even when you set triggerAction:'all').

To avoid the filter being activated you need to configure your combobox with:

triggerAction: 'all',
lastQuery: '' // == allQuery

11 Jan 2010, 5:33 AM
hi condor,

lastQuery: '' the filter is never applied, i need the opposite direction: always apply it.

the problem is, that the behaviour of the comboBox is different, when the list was opened and before that point (even with lazyInit:false). without clicking the trigger / showing the list, the filter does not apply, afterwards it does.

so, if the filter would be applied in the first case too, everything would be consistent and fine.

kind regards,

11 Jan 2010, 5:40 AM
No, your filter is always applied, but without lastQuery:'' the combobox will clear the filter the first time it is used.

27 May 2010, 3:20 PM
This works fine!!!