PDA

View Full Version : Stop the renderTo/applyTo madness (for Containers/Layouts)



hendricd
12 May 2009, 4:51 AM
How about it?
If a Component participates in a layout, just kill the offensive renderTo cfg ?

Proposed Container override:


// private
onBeforeAdd : function(item){
if(item.ownerCt){
item.ownerCt.remove(item, false);
}
if(this.hideBorders === true){
item.border = (item.border === true);
}
item.renderTo = null; //<---
},

Condor
12 May 2009, 5:11 AM
Yes, and change 'applyTo' to 'el'.

mystix
12 May 2009, 6:34 AM
i say remove it altogether:


onBeforeAdd : function(item){
if(item.ownerCt){
item.ownerCt.remove(item, false);
}
if(this.hideBorders === true){
item.border = (item.border === true);
}
delete item.renderTo;
},

Condor
12 May 2009, 6:39 AM
So you end up with:

onBeforeAdd : function(item){
if(item.ownerCt){
item.ownerCt.remove(item, false);
}
if(this.hideBorders === true){
item.border = (item.border === true);
}
delete item.renderTo;
if(!item.el && item.applyTo){
item.el = item.applyTo;
}
delete item.applyTo;
},

mystix
12 May 2009, 6:41 AM
sorry, i'm feeling nitpicky >:)


onBeforeAdd : function(item){
if(item.ownerCt){
item.ownerCt.remove(item, false);
}
if(this.hideBorders === true){
item.border = (item.border === true);
}
Ext.applyIf(item, item.applyTo);
delete item.renderTo;
delete item.applyTo;
},

Condor
12 May 2009, 6:42 AM
No, you meant:

onBeforeAdd : function(item){
if(item.ownerCt){
item.ownerCt.remove(item, false);
}
if(this.hideBorders === true){
item.border = (item.border === true);
}
Ext.applyIf(item, {el: item.applyTo});
delete item.renderTo;
delete item.applyTo;
},

mystix
12 May 2009, 6:42 AM
No, you mean:

onBeforeAdd : function(item){
if(item.ownerCt){
item.ownerCt.remove(item, false);
}
if(this.hideBorders === true){
item.border = (item.border === true);
}
Ext.applyIf(item, {el: item.applyTo});
delete item.renderTo;
delete item.applyTo;
},

yes i did indeed. :)

aconran
18 May 2009, 6:38 AM
I like this idea, but not for the base library. We intend to create an additional helper file which will warn people about potential issues in their application. This would be something to implement in this file and not just auto fix it, tell the developer about it by raising an exception.

This way developers end up with proper code and we don't have to worry about supporting things that should not have worked in the first place.

smokeman
29 Dec 2009, 12:08 PM
I love that idea Aaron...
when might we see something like that?