coderobo
15 Aug 2008, 4:06 PM
All over in ext-all-debug.js I see this pattern :
this.id = this.id || Ext.id();or
getId : function(){
return this.id || (this.id = "ext-comp-" + (++Ext.Component.AUTO_ID));
},
If I pass in a ctor config id as numeric 0, you can see the code
would break and end up using use Ext.id() instead of using the number 0 as the id.
Correct pattern to use would be -
this.id = this.id == undefined ? Ext.id() : this.id;
this.id = this.id || Ext.id();or
getId : function(){
return this.id || (this.id = "ext-comp-" + (++Ext.Component.AUTO_ID));
},
If I pass in a ctor config id as numeric 0, you can see the code
would break and end up using use Ext.id() instead of using the number 0 as the id.
Correct pattern to use would be -
this.id = this.id == undefined ? Ext.id() : this.id;