Ext.override(Ext.Component, { replaceWith : function(newComponent) { var ctnr = this.ownerCt; // if the refOwner is a form or if newComponent.ownerForm config is set to the form var form = newComponent.ownerForm ? newComponent.ownerForm : this.refOwner.form; var i = ctnr.items.indexOf(this); // apply initialConfig Ext.applyIf(newComponent, this.initialConfig); ctnr.remove(this, true); var added = ctnr.insert(i, newComponent); // if the component is in a form if (form) { // remove the old component from the form form.remove(this); // add the new component to the form form.add(added); } } });
Tem alguma coisa parecida para Ext4? ou tem alguma coisa nativa?
Charles