directly to insert fields into an already rendered fieldSet.
Is there a new 2.0 way of doing this that is sweet and easy?
I'll be using it like this:
{
xtype:'fieldset',
id: 'FIND_Search_form_fieldset_entry',
title: 'Entry',
collapsible: true,
titleCollapse: true,
autoHeight:true,
autoWidth:true,
defaultType: 'textfield',
items :[{
xtype:'button',
text: 'Add an Identifier',
handler: function(){
Ext.getCmp('FIND_Search_form_fieldset_entry').inse rt(1, {fieldLabel: 'Another Field'});
Ext.getCmp('FIND_Search_form_fieldset_entry').doLa yout();
}
}]
}From where im doing this, is there a better way of grabbing my buttons parent container?
I'd prefer to avoid assigning id's if possible.
form = new Ext.form.FormPanel({
defaultType: 'textfield',
items: [{
fieldLabel: 'Field 1'
}, {
fieldLabel: 'Field 2'
}],
renderTo: Ext.getBody()
});
form.insert(1, {
fieldLabel: 'Field 3'
});
form.doLayout();
EDIT. You mentioned fieldsets, so I modified the code a bit:
form = new Ext.form.FormPanel({
width: 360,
bodyStyle: 'padding: 1em',
items: [{
xtype:'fieldset',
id: 'fieldset1',
title: 'User Information',
autoHeight:true,
defaultType: 'textfield',
items :[{
fieldLabel: 'First Name',
name: 'first',
allowBlank:false
},{
fieldLabel: 'Last Name',
name: 'last'
}
]
}],
renderTo: Ext.getBody()
});
Ext.getCmp('fieldset1').insert(1, {
fieldLabel: 'Another Field'
});
Ext.getCmp('fieldset1').doLayout();
#If you have any other info about this subject , Please add it free.# |