PDA

View Full Version : [CLOSED][3.0.3] Spinner broken



keckeroo
10 Dec 2009, 9:44 PM
Just trying to get the spinner example working in 3.0.3. Downloaded source directly from ext examples shown on the website.

Source indicates the example uses Ext 3.0+ not Ext 3.0.3 (uses http://www.extjs.com/deploy/dev/ext-all.js)

Error i'm getting is from setting the *width* of the spinner field and this is the error :



this.field.adjustWidth is not a function
Spinner.js: line 106


this is the offending line ...



doResize: function(w, h){
if (typeof w == 'number') {
>>>>> this.el.setWidth(this.field.adjustWidth('input', w - this.trigger.getWidth()));
}
this.wrap.setWidth(this.el.getWidth() + this.trigger.getWidth());
},


any help would be greatly appreciated.

Kevin

keckeroo
10 Dec 2009, 10:39 PM
It appears that the methods 'adjustSize' and 'adjustWidth' are no longer found in Ext.form.Field.

Not sure how to overcome this.

Kev

evant
11 Dec 2009, 2:00 PM
It's fixed in the trunk and will be released with 3.1.

TheBerliner
7 Jan 2010, 7:07 AM
It's fixed in the trunk and will be released with 3.1.
Well, that obviously did not make it into the released 3.1 code, because for me this did work in 3.0.x but it now crashes in 3.1, because these methods are missing in form.Field.

Any hint what to do?

The error occurs here in class ux.Spinner:


doResize: function(w, h){
if (typeof w == 'number') {
this.el.setWidth(this.field.adjustWidth('input', w - this.trigger.getWidth()));
}
this.wrap.setWidth(this.el.getWidth() + this.trigger.getWidth());
},
Same code worked in 3.0.x.

It also seems that the cause cannot be in class Spinner, because there are no changes mentioned in the change log for 3.1 nor is any new code supplied.

TheBerliner
7 Jan 2010, 8:48 AM
Update:

In order to get over this crash, I just added the old code of adjustWidth() to R 3.1 class Ext.form.Field and it works in my dev environment in FF 3.5, although I cannot say if this applies to all situations.

mystix
16 Jan 2010, 7:57 AM
[ friendly bump ]

also marked this thread [REOPENED].

evant
17 Jan 2010, 6:58 PM
I'm not really sure what you're referring to. The last change was made to this file on the 25th August, in which I removed the reference to adjustWidth.

See the source here: http://www.extjs.com/deploy/ext-3.1.1-beta/examples/ux/Spinner.js

or here

http://www.extjs.com/deploy/ext-3.1.0/examples/ux/Spinner.js

Both don't include that code.

TheBerliner
11 Feb 2010, 9:58 PM
Well, that obviously did not make it into the released 3.1 code,
I just discovered that this fix did not make it into Ext 3.1.1. either.

Thus, this bug persists (see above post #4):


doResize: function(w, h){
if (typeof w == 'number') {
this.el.setWidth(this.field.adjustWidth('input', w - this.trigger.getWidth()));
}
this.wrap.setWidth(this.el.getWidth() + this.trigger.getWidth());
},Same code worked in 3.0.x.

I would very much appreciate to be informed if the absence of this fix is some mistake or if the usage of this code in Spinner class is wrong and, if so, how it should be changed.

evant
11 Feb 2010, 10:09 PM
Which line in the file is wrong: http://www.extjs.com/deploy/dev/examples/ux/Spinner.js

The code isn't there.

TheBerliner
11 Feb 2010, 10:21 PM
Which line in the file is wrong: http://www.extjs.com/deploy/dev/examples/ux/Spinner.js

The code isn't there.
Thank you for the extremely quick response and I apologize for having bugged you: I was not aware that Spinner class is part of the official Ext distribution.

My Spinner code comes from some forum download and I remember that it then was some user addition but I don't have the url anymore.

Thank you again and pardon.

webby
12 Feb 2010, 2:46 AM
I am also having problems with an extended datefield component that uses this.adjustwidth().



onResize : function(w, h){
Ext.form.TriggerField.superclass.onResize.call(this, w, h);
var tw = this.trigger.getWidth() || (17 * (this.timeFields.length+1));
var elw = this.el.getWidth();
if(typeof w == 'number'){
elw = this.adjustWidth('input', w - tw);
this.el.setWidth(elw);
}
this.wrap.setWidth(elw+tw);
},


I see that there is a declaration for the adjustWidth() method in Ext.form.Field but the method is private. I presume that the method did not used to be private?


// private
adjustWidth : function(tag, w){
if(typeof w == 'number' && (Ext.isIE && (Ext.isIE6 || !Ext.isStrict)) && /input|textarea/i.test(tag) && !this.inEditor){
return w - 3;
}
return w;
}

Oh and forgot to say was using the latest download of 3.1.1

Gonfi
26 Feb 2010, 3:00 AM
this tutorial http://www.extjs.com/learn/Tutorial:Creating_new_UI_controls also uses that outdated code. what's the new way?