PDA

View Full Version : ExtJS 2.0 RC1 - Numberfield Trigger Problem



wki
25 Nov 2007, 9:08 AM
How can use TriggerField with NumberField?
I try to extend but... ...button clear doesn't appear!!




Ext.namespace('Ext.ux');

Ext.ux.NumberFieldTrigger = Ext.extend(Ext.form.NumberField, {
initComponent : function () {
Ext.form.TriggerField.superclass.initComponent.call(this);

},

getTrigger : Ext.form.TriggerField.prototype.getTrigger,
initTrigger : Ext.form.TriggerField.prototype.initTrigger,

triggerClass : 'x-form-clear-trigger',
hideTrigger : false,

onTriggerClick : function(){
alert('onTrigger1Click');
}
});

tryanDLS
25 Nov 2007, 9:13 AM
You can't extend one class and then call the superclass of another class. If anything, you should just be extending TriggerField to do something. What are you trying to accomplish?

wki
25 Nov 2007, 9:16 AM
I see this POST and try it with NumberField
http://extjs.com/forum/showthread.php?t=15842

I want a NumberField with clear button!

wki
25 Nov 2007, 9:36 AM
Ext.namespace('Ext.ux');

Ext.ux.NumberFieldTrigger = function(config) {
Ext.ux.NumberFieldTrigger.superclass.constructor.call(this, config);
}

Ext.ux.NumberFieldTrigger = Ext.extend(Ext.form.TriggerField, {

allowDecimals : Ext.form.NumberField.prototype.allowDecimals,
allowNegative : Ext.form.NumberField.prototype.allowNegative,

baseChars : Ext.form.NumberField.prototype.baseChars,
decimalPrecision : Ext.form.NumberField.prototype.decimalPrecision,
decimalSeparator : Ext.form.NumberField.prototype.decimalSeparator,
fieldClass : Ext.form.NumberField.prototype.fieldClass,
maxText : Ext.form.NumberField.prototype.maxText,
maxValue : Ext.form.NumberField.prototype.maxValue,
minText : Ext.form.NumberField.prototype.minText,
minValue : Ext.form.NumberField.prototype.minValue,
nanText : Ext.form.NumberField.prototype.nanText,

beforeBlur : Ext.form.NumberField.prototype.beforeBlur,
fixPrecision : Ext.form.NumberField.prototype.fixPrecision,
getValue : Ext.form.NumberField.prototype.getValue,
initEvents : Ext.form.NumberField.prototype.initEvents,
parseValue : Ext.form.NumberField.prototype.parseValue,
setValue : Ext.form.NumberField.prototype.setValue,
validateValue : Ext.form.NumberField.prototype.validateValue,

triggerClass : 'x-form-clear-trigger',
hideTrigger : false,

onTriggerClick : function() {

alert('onTriggerClick');

}
});