-
9 Jul 2008 2:39 AM #1
combo store filter does not work on first time trying
combo store filter does not work on first time trying
hello all.
i have encountered a weird scenario regarding store.filter. on my linked combo boxes.
at first the filtering to my second comboxes does not work but after trying again it will work every on the 2nd time of try.
here is my code for my parent combo box
please do help been searching for the solutionCode:new Ext.form.ComboBox({ hiddenName:'cboaction', fieldLabel:jAuditTrailMessages.info.cboLblAction, store: storeActionType, valueField:'value', displayField:'desc', value:'', typeAhead: false, triggerAction: 'all', emptyText:jAuditTrailMessages.info.txtSelectEvent, editable:false, name:'event', anchor: '95%', triggerAction: 'all', mode:'local' , listeners:{select:{fn:function(combo, record, index) { var comboCls = Ext.getCmp('classificationCmb'); comboCls.setValue(''); comboCls.store.filter('classification', combo.getValue(), true ); }); }} } })
big thanks
akel
-
21 Jul 2008 7:25 AM #2
Same problem!
Same problem!
Hi,
have you solved your problem?
My code is a bit different, but the problem is the same. I used the linked combo tutorial, the one with the local data of USA and MEXICO, and what I have done it's to use JsonStore instead of simpleStore.
I can't solve it with the help of the hints of Saki, because the lastquery:'' , it seems, stops the loading of the values in the second combo.
Here there are the data:
Here there are the combo:Code:var storeProfiles = new Ext.data.JsonStore({ url:'/admin/Admin/UserGetProfiles', fields: ['Id_Profile','Id_Categories','Label','Description'] }); var storePermissions = new Ext.data.JsonStore({ url:'/admin/Admin/UserGetPermissions', fields: ['Id_ProfilePermission','Id_Profiles','Id_Permission','Label'] });
Thanks in advance to everyone who could help us!Code:comboProfiles = new Ext.form.ComboBox({ id: 'comboprofiles', store: storeProfiles, lazyInit:'false', method: 'POST', hiddenId: 'Label', editable:false, disabled:true, fieldLabel:'Profile', valueField: 'Id_Profile', displayField:'Label', typeAhead: true, triggerAction: 'all', emptyText:'Select a profile...', selectOnFocus:true, allowBlank:false, blankText:'This is a mandatory field', listeners:{select:{fn:function(combo, value) { var comboLinkedPermissions = Ext.getCmp('combopermissions'); comboLinkedPermissions.enable(); comboLinkedPermissions.clearValue(); comboLinkedPermissions.store.filter('Id_Profiles', this.getValue()); }} } }); comboPermissions = new Ext.form.ComboBox({ id: 'combopermissions', store: storePermissions, lazyInit:'false', method: 'POST', hiddenId: 'Label', editable:false, disabled:true, fieldLabel:'Permission', valueField: 'Id_ProfilePermission', displayField:'Label', typeAhead: false, mode: 'remote', triggerAction: 'all', emptyText:'Select the permissions...', selectOnFocus:true, allowBlank:false, blankText:'This is a mandatory field' });
-
3 Oct 2008 8:04 AM #3
Hi!
I have the same problem.
I have tried to call a initList before to call the filter method.
But nothing change.
Any suggestion?
-
14 Oct 2008 1:29 AM #4
SOLVED!
SOLVED!
i have the same problem trying linking 3 combo boxes.
First run doesn't filter correctly, second ok.
I simply add this line lastquery:'' befor each listener command.
ex:
[...]
mode: 'local',
lastQuery: '',
listeners: {select:{fn:function(combo, value) {
var comboCls = Ext.getCmp('comboV');
[...]
Bye
Andrea
-
14 Oct 2008 1:32 AM #5
thanks!
I have resolve my mistake with a config parameter, but now I try with your solution!
-
6 Nov 2008 11:59 AM #6
-
14 Nov 2008 12:29 AM #7
I use 3 config options to determine if add the blank options and the value/text properties of the blank options:
arrConfig is an array that contains all the config of my combo.Code:... arrConfig ['blankOption'] = fgBlank; if (fgBlank) { arrConfig ['blankKey'] = blankValue; arrConfig ['blankText'] = blankText; } objCombo = new Ext.form.MyComboBox(arrConfig);
And this is the override of the initList method I have write for my combo
Code:initList : function(){ if(!this.list){ var cls = 'x-combo-list'; this.list = new Ext.Layer({ shadow: this.shadow, cls: [cls, this.listClass].join(' '), constrain:false }); var lw = this.listWidth || Math.max(this.wrap.getWidth(), this.minListWidth); this.list.setWidth(lw); this.list.swallowEvent('mousewheel'); this.assetHeight = 0; if(this.title){ this.header = this.list.createChild({cls:cls+'-hd', html: this.title}); this.assetHeight += this.header.getHeight(); } this.innerList = this.list.createChild({cls:cls+'-inner'}); this.innerList.on('mouseover', this.onViewOver, this); this.innerList.on('mousemove', this.onViewMove, this); this.innerList.setWidth(lw - this.list.getFrameWidth('lr')); if(this.pageSize){ this.footer = this.list.createChild({cls:cls+'-ft'}); this.pageTb = new Ext.PagingToolbar({ store:this.store, pageSize: this.pageSize, renderTo:this.footer }); this.assetHeight += this.footer.getHeight(); } if(!this.tpl){ this.tpl = '<tpl for="."><div class="'+cls+'-item">{' + this.displayField + '}</div></tpl>'; } this.view = new Ext.DataView({ applyTo: this.innerList, tpl: this.tpl, singleSelect: true, selectedClass: this.selectedClass, itemSelector: this.itemSelector || '.' + cls + '-item' }); if (this.initialConfig.blankOption) { var blankKey = this.initialConfig.blankKey; if (blankKey==null) { blankKey = ''; } var blankText = this.initialConfig.blankText; if (blankText==null) { blankText = ' nbsp;'; } var rowRecord = Ext.data.Record.create(this.store.fields); var arrFields = new Array(); for (i=0,len=this.store.fields.items.length;i<len;i++) { if (this.store.fields.items[i].name==this.store.reader.meta.id) { var pValue = " "; arrFields [this.store.fields.items[i].name] = blankKey; } else { arrFields [this.store.fields.items[i].name] = blankText; } } this.store.insert(0, new rowRecord(arrFields)); } this.view.on('click', this.onViewClick, this); this.bindStore(this.store, true); if(this.resizable){ this.resizer = new Ext.Resizable(this.list, { pinned:true, handles:'se' }); this.resizer.on('resize', function(r, w, h){ this.maxHeight = h-this.handleHeight-this.list.getFrameWidth('tb')-this.assetHeight; this.listWidth = w; this.innerList.setWidth(w - this.list.getFrameWidth('lr')); this.restrictHeight(); }, this); this[this.pageSize?'footer':'innerList'].setStyle('margin-bottom', this.handleHeight+'px'); } } }
-
29 Jul 2009 5:02 AM #8
try with expand event
Code:listeners:{ expand:function(){ console.log("toto"); } }
-
20 Jan 2010 10:12 PM #9
Thank you! Solved the same problem which I was having.
-
27 Jun 2012 12:50 AM #10


Reply With Quote