-
2 Dec 2008 10:14 PM #11
Yes, but your code references the object by name...
The proper clean way to override the function, and which works fine for me is the following:
-VCode:Ext.override(Ext.form.ComboBox, { // private doForce : function() { if (this.el.dom.value != this.emptyText && this.el.dom.value.length > 0) { this.el.dom.value = this.lastSelectionText === undefined? '' : this.lastSelectionText; this.applyEmptyText(); } else { this.clearValue(); } } });
-
28 Aug 2009 7:33 AM #12
This override:
1) did not work for me, the value is still being set back to empty text
2) at least from reading the code, the above seems like what this override would do. I mean, semantically there does not seem to be a lot of difference between applyEmptyText() and clearValue(). Semantics aside, its obvious that the first condition does not retain the value of "this.el.dom.value"
-
28 Aug 2009 8:06 AM #13
Without delving into the arcana surrounding lastSelectionText because, after all, I'm trying to write a business application here, as opposed to a Javascript framework, isn't the following what is actually correct, retaining the value of this.el.dom.value as appropriate?
Code:Ext.override(Ext.form.ComboBox, { // private doForce : function() { if (this.el.dom.value != this.emptyText && this.el.dom.value.length > 0) { this.el.dom.value = this.lastSelectionText === undefined? this.el.dom.value : this.lastSelectionText; this.applyEmptyText(); } else { this.clearValue(); } } });
-
28 Aug 2009 8:15 AM #14
-
28 Aug 2009 8:41 AM #15
-
28 Aug 2009 9:38 AM #16
So what I'm now doing at the top of our override is the following, it may not be ideal, but it has a similar effect to the call to setValue in onSelect (when the latter is not overridden):
Additionally, apologies the attitudeCode:this.lastSelectionText=record.data[this.valueField || this.displayField];
-
28 Aug 2009 10:11 AM #17
Sencha Docs / Ext 3.x - ( Docs | Examples )
Learning Center / Saki's Examples (for 2.x) / HOWTO - ( Report Bugs | Post Proper Code )
-
28 Aug 2009 10:51 AM #18
-
28 Aug 2009 11:05 AM #19
Sencha Docs / Ext 3.x - ( Docs | Examples )
Learning Center / Saki's Examples (for 2.x) / HOWTO - ( Report Bugs | Post Proper Code )



Reply With Quote