Inserting fields into fieldSet after render

  • In 1.1 I had to write a crazy function that had to manipulate the dom
    directly to insert fields into an already rendered fieldSet.

    Is there a new 2.0 way of doing this that is sweet and easy?


  • That is exactly what i meant :)

    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.


  • You mean like this?


    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.#
    Your name:
    E-mail:
    Telphone:

    Your comments:


    If you have any other info about Inserting fields into fieldSet after render , Please add it free.