PDA

View Full Version : [FIXED][3.0.0] FormPanel initFields and onAdd



stever
2 Jul 2009, 1:17 PM
Is there a reason why the logic is different between the two functions for adding fields to the basicForm?


// private
initFields : function(){
var f = this.form;
var formPanel = this;
var fn = function(c){
if(formPanel.isField(c)){
f.add(c);
}if(c.isFieldWrap){
Ext.applyIf(c, {
labelAlign: c.ownerCt.labelAlign,
labelWidth: c.ownerCt.labelWidth,
itemCls: c.ownerCt.itemCls
});
f.add(c.field);
}else if(c.doLayout && c != formPanel){
Ext.applyIf(c, {
labelAlign: c.ownerCt.labelAlign,
labelWidth: c.ownerCt.labelWidth,
itemCls: c.ownerCt.itemCls
});
//each check required for check/radio groups.
if(c.items && c.items.each){
c.items.each(fn, this);
}
}
};
this.items.each(fn, this);
},


// private
onAdd : function(ct, c) {
// If a single form Field, add it
if (this.isField(c)) {
this.form.add(c);
// If a Container, add any Fields it might contain
} else if (c.findBy) {
Ext.applyIf(c, {
labelAlign: c.ownerCt.labelAlign,
labelWidth: c.ownerCt.labelWidth,
itemCls: c.ownerCt.itemCls
});
this.form.add.apply(this.form, c.findBy(this.isField));
}
},

stever
8 Jul 2009, 3:46 PM
bump...

Animal
8 Jul 2009, 11:50 PM
It's a good question. There is no reference to "isFieldWrap" anywhere else in the Ext source so I don't know what that code block is for.

evant
9 Jul 2009, 6:51 AM
Not sure what isFieldWrap was for. A fix for this has been committed to the trunk.