-
21 Jul 2007 12:18 PM #1
[TIP] Destroy form every time !
[TIP] Destroy form every time !
In specific context, i need to reder dynamic form with diferents fields. So with this code, i recreate without problem the form every time...
this code worksforme:
and the objectCode:createForm : function(paramType,paramList) { if(form) { Ext.get('paramForm').remove(); form = null; } form = new Ext.form.Form({id: 'paramForm'});
thats is !!!Code:ParametersEditorDialog = function(){ var form; var dialog; return { createForm : function(paramType,paramList) { if(form) { Ext.get('paramForm').remove(); form = null; } form = new Ext.form.Form({id: 'paramForm'}); form.add( new Ext.form.TextField({ fieldLabel: paramType, name: 'first', width:175, allowBlank:false, id: 'f1' })); //Render form.render('parameters-dialog-form'); } //... cuted here }; //Function end }();
DaviLast edited by Davi Baldin; 21 Jul 2007 at 4:18 PM. Reason: grammar error
-
22 Jul 2007 4:19 PM #2Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- Frederick MD, NYC, DC
- Posts
- 16,167
- Vote Rating
- 28
Yeah, once a form is rendered you do have to destroy it other wise you can't add things to it dynamically ,etc.

Jay Garcia @ModusJesus || Modus Create co-founder
Ext JS in Action author
Sencha Touch in Action author
Get in touch for Ext JS & Sencha Touch Touch Training
We are also working on Video-based Sencha Touch training: Check it out here.
-
25 Jul 2007 4:01 AM #3
To avoid giving the form an id, which I don't like doing:
PHP Code:if (form) {
form.el.remove();
form = null;
};


Reply With Quote