Dynamically add components to a specific set of fields in FormPanel

Dynamically add a text field to a specific field fieldset , Extra is set here, since I have many fields in the form, so here I use the code for only one field.

eg,

var extraData = [{ bodyStyle: 'padding-left:5px;', items:{ xtype:'fieldset', title: 'Extra', collapsible: true, autoHeight:true, layout:'column', items:[{ columnWidth:.5, layout: 'form', items: [{ xtype:'textfield', fieldLabel: 'Comment', name: 'comment', anchor:'95%' }] },{ columnWidth:.5, layout: 'form', items: [{ xtype: 'fileuploadfield', fieldLabel: 'Photo', name: 'last', anchor:'95%' }] }] } }]; var fsf = new Ext.FormPanel({ labelWidth: 75, // label settings here cascade unless overridden url:'save-form.php', frame:true, title: 'Enter New Groom Record', msgTarget: 'side', width: 650, items:extraData }); 
+4
source share
1 answer

Give the identifier to the file and form.

Then do

 Ext.getCmp('myfieldset-id').add(my_dynamic_new_component); Ext.getCmp('myform-id').doLayout(); 
+4
source

Source: https://habr.com/ru/post/1347565/


All Articles