|
|||||||
![]() |
|
|
Thread Tools |
|
#1
|
|||
|
|||
|
After update to 2.2 a call to setValue on a checkbox with rendered == false causes exception "this.wrap is undefined".
|
|
#2
|
||||
|
||||
|
There is a workaround here.
__________________
ExtJS license owner |
|
#3
|
||||
|
||||
|
Yes, setValue() seems flawed. I also have my doubts about getValue() always returning false for unrendered checkboxes.
I propose the following changes: Ext.override(Ext.form.Checkbox, {
getValue : function(){
if(this.rendered){
return this.el.dom.checked;
}
return this.checked;
},
setValue : function(v) {
var checked = this.checked;
this.checked = (v === true || v === 'true' || v == '1' || String(v).toLowerCase() == 'on');
if(this.rendered){
this.el.dom.checked = this.checked;
this.el.dom.defaultChecked = this.checked;
this.wrap[this.checked? 'addClass' : 'removeClass'](this.checkedCls);
}
if(checked != this.checked){
this.fireEvent("check", this, this.checked);
if(this.handler){
this.handler.call(this.scope || this, this, this.checked);
}
}
}
});
|
|
#4
|
|||
|
|||
|
Condor,ovan
Thanks for your help! |
|
#5
|
|||
|
|||
|
The work-around posted above works. I had an Ext.Window calling the loadRecord method on the "afterlayout" event which caused the this.wrap is undefined issue, the override works, phew!
|
|
#6
|
||||
|
||||
|
Fixed in SVN.
|
|
#7
|
|||
|
|||
|
Mate -
Thanks for the reply. I made the necessary changes in ext-all-debug.js, suppose i am changing in the right place, but still struck with same issue. Is the latest fix available in SVN? or when it is expected. Cheers. |
|
#8
|
|||
|
|||
|
I know this is an old topic but I would like to add that this results under Adobe AIR in a rather helpful error (this back trace comes from Aptana Studio):
TypeError: Undefined value at app:/lib/ext/ext-all-debug.js : 28140 selectRemoteInstance at app:/spice_loader.js : 89 at app:/spice_loader.js : 184 at app:/lib/ext/ext-all-debug.js : 1488 at app:/lib/ext/ext-all-debug.js : 1184 at app:/lib/ext/ext-all-debug.js : 12436 at app:/lib/ext/ext-all-debug.js : 14062 at app:/lib/ext/ext-all-debug.js : 14352 at app:/lib/ext/ext-all-debug.js : 14341 at app:/lib/ext/ext-all-debug.js : 14471 at app:/lib/ext/ext-all-debug.js : 14331 at app:/lib/ext/ext-all-debug.js : 14431 at app:/lib/ext/ext-all-debug.js : 14327 at app:/lib/ext/ext-all-debug.js : 14206 at app:/spice_loader.js : 46 at app:/lib/ext/ext-all-debug.js : 14073 at app:/lib/ext/ext-all-debug.js : 14670 at app:/lib/ext/ext-all-debug.js : 14327 at app:/lib/ext/ext-all-debug.js : 14206 at app:/lib/ext/ext-all-debug.js : 14079 at app:/lib/ext/ext-all-debug.js : 12375 at app:/lib/ext/adapter/ext/ext-base.js : 9 at app:/lib/ext/adapter/ext/ext-base.js : 9 at app:/lib/ext/adapter/ext/ext-base.js : 9 bootstrap at app:/spice_loader.js : 565 at app:/lib/ext/ext-all-debug.js : 1488 at app:/lib/ext/ext-all-debug.js : 1593 at app:/lib/ext/adapter/ext/ext-base.js : 10 undefined at undefined : undefined ![]() The solution to this is to either implement the workaround or check if the component is rendered or not: if it ain't, set the value directly in 'component.checked'. I hope this will save other AIR developers the 30 minutes or more it took me to figure this out on my own ^^ |
![]() |
| Thread Tools | |
|
|