PDA

View Full Version : Change suggestion for FormPanel onAdd method



mankz
19 Dec 2008, 11:45 AM
I wanted to add a fieldset to a FormPanel after render. To be able to do that I used an override (bottom code snippet), maybe the onAdd method should be changed?

Default implementation :


onAdd: function(ct, c) {
if (c.isFormField) {
this.form.add(c);
}
},


Proposed change :

// Override this method to be able to add any container items to the actual form
onAdd: function(ct, c) {
if (c.isFormField) {
this.form.add(c);
} else if (c.items) {
this.form.add.apply(this.form, c.items.getRange());
}
},

evant
19 Dec 2008, 7:58 PM
In 3.0 there's something to deal with that: http://extjs.com/forum/showthread.php?t=41093&highlight=onAdd

In the 2.x branch we're considering something similar to what you've got there.