PDA

View Full Version : SpinnerField no change event



csky
15 Jul 2009, 1:29 PM
I am trying to get a change event when someone types directly into the SpinnerField. It seems like it should since it extends NumberField. onBlur is set to an empty function in the SpinnerField configuration which I presume is the reason why there is no change event. Is there convenient way to get a change like event?

troy_mccormick
15 Jul 2009, 3:55 PM
Hmm...I'm having the same issue. In fact, I'm not sure how to go about getting any of the changes...I'm a dunce though :-D

csky
15 Jul 2009, 5:45 PM
Hmm...I'm having the same issue. In fact, I'm not sure how to go about getting any of the changes...I'm a dunce though :-D

Try registering a handler on the 'spin' event

mjlecomte
15 Jul 2009, 8:21 PM
Not sure the rationale for disabling it completely but I was able to remedy it a bit by doing:

Ext.ux.Spinner

// private
triggerBlur: function(){
this.mimicing = false;
Ext.get(Ext.isIE ? document.body : document).un("mousedown", this.mimicBlur, this);
this.el.un("keydown", this.checkTab, this);
this.field.beforeBlur();
this.wrap.removeClass('x-trigger-wrap-focus');
//this.field.onBlur.call(this.field);
},



Ext.ux.form.SpinnerField = Ext.extend(Ext.form.NumberField, {
actionMode: 'wrap',
deferHeight: true,
autoSize: Ext.emptyFn,
//onBlur: Ext.emptyFn,

csky
16 Jul 2009, 5:34 AM
Not sure the rationale for disabling it completely but I was able to remedy it a bit by doing:


I am still testing, but this seems to work well. Thanks for you speedy help.

Kcarpenter
2 Nov 2010, 4:54 AM
WOW! Glad I found this thread after 5 hours of beating my head against the wall. Sencha, Ill be sending you the medical bills.

berni_777
24 Nov 2010, 8:04 AM
Hallo,

I'm having similar problems with the Spinnerfield. Let's consider the following simple situation:

We have Spinnerfield with a default value and a button with an alert function which displays the Spinnerfield's value on the screen.


{
xtype:'button',
text:'display',
width:200,
y:600,
x:450,
handler: function()
{
var val = Ext.getCmp('spinnerf1').value;
alert(val);
},
}

This would display the default value without problems. But if I change the value by using the spinner the button would still display the default value. In contrast, when changing the value by writting into the field, the button would display the actual value correctly.

I've tried deactivating
//this.field.onBlur.call(this.field);

in Spinner.js

and

//onBlur: Ext.emptyFn,

in SpinnerField.js like it was recommended here, but it still doesn't work at all. Has anyone an idea what I'm doing wrong here? (Btw, I'm still new to ExtJS, as you may have noticed :) )

talha06
24 Aug 2011, 12:31 AM
AM
thank you so much mjlecomte, works very well.. I've been looking this solution.. :)