From: <pru...@us...> - 2011-07-18 18:54:29
|
Revision: 5447 http://jaffa.svn.sourceforge.net/jaffa/?rev=5447&view=rev Author: prudhvireddy Date: 2011-07-18 18:54:23 +0000 (Mon, 18 Jul 2011) Log Message: ----------- Bug fix 19619 :Added beforequery listener on expand, otherwise this listener is setting the store to local for initial value. This will make sure data is fetched before setting the store to local when recs < 25. Removed condition to prefetch without any parameters to determine the total number of records, it is not required anymore Modified Paths: -------------- branches/JAFFA_5_10_RELEASE/JaffaRIA/source/html/js/extjs/jaffa/finder/FinderComboBox.js Modified: branches/JAFFA_5_10_RELEASE/JaffaRIA/source/html/js/extjs/jaffa/finder/FinderComboBox.js =================================================================== --- branches/JAFFA_5_10_RELEASE/JaffaRIA/source/html/js/extjs/jaffa/finder/FinderComboBox.js 2011-07-18 18:48:19 UTC (rev 5446) +++ branches/JAFFA_5_10_RELEASE/JaffaRIA/source/html/js/extjs/jaffa/finder/FinderComboBox.js 2011-07-18 18:54:23 UTC (rev 5447) @@ -174,7 +174,7 @@ } } } - + // determine the fieldLabel // disabling this functionality - let component set label. if (false && !this.fieldLabel) { @@ -182,21 +182,23 @@ var field = this.meta.fields[fieldName]; this.fieldLabel = field.label; } - - // Fires before all queries are processed. - // Will change the mode to 'local', if the Store is flagged as 'loaded' and forceRemoteQuery is set to false. - // The combo will thus filter the data locally, without the need to fire remote events. - this.addListener('beforequery', function(queryEvent) { - if (queryEvent.combo.store.isLoaded && queryEvent.combo.mode != 'local'){ - if(queryEvent.combo.forceRemoteQuery) { - //This is remove the cached lastQuery and force a remote query every time. - delete queryEvent.combo.lastQuery; - } else { - queryEvent.combo.mode = 'local'; + + this.on('expand', function(){ + // Fires before all queries are processed. + // Will change the mode to 'local', if the Store is flagged as 'loaded' and forceRemoteQuery is set to false. + // The combo will thus filter the data locally, without the need to fire remote events. + this.addListener('beforequery', function(queryEvent) { + if (queryEvent.combo.store.isLoaded && queryEvent.combo.mode != 'local'){ + if(queryEvent.combo.forceRemoteQuery) { + //This is remove the cached lastQuery and force a remote query every time. + delete queryEvent.combo.lastQuery; + } else { + queryEvent.combo.mode = 'local'; + } } - } - }); - + }); + },this,{single : true}) + // Validates the value when the field is modified this.addListener('change', function(combo, newValue, oldValue) { console.debug('value changed: '+ newValue); @@ -286,12 +288,6 @@ * @param {boolean} doNotAutoselect If true, and if the input value is not a Record, then the doAutoselect() will not be invoked to obtain more details. Use this only when not wanting additional details. */ setValue: function(v, doNotAutoselect) { - //Initially loading the store without any parameters to determine the total number of records - //Otherwise initial value is sent as a parameter; store will be changed to local mode and it will never fetch remaining records. - if(!this.store.isLoaded || !Ext.isDefined(this.store.totalLength)){ - this.store.on('load', this.setValue.createDelegate(this, arguments), null, {single: true}); - this.store.load(); - } else { if (v instanceof Ext.data.Record) { if (!this.findRecord(this.valueField, v.data[this.valueField])) this.store.add([v]); @@ -314,7 +310,6 @@ // The following repeat call to validate() is necessary since it'll validate the actual-value. if (this.rendered && !this.textOnly) this.validate(); - } }, @@ -527,7 +522,7 @@ ,onTriggerClick: function() { if (this.disabled) return; - + // setup the baseParams this.setUpBaseParams(); Jaffa.form.FinderComboBox.superclass.onTriggerClick.call(this); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |