PDA

View Full Version : Problems with .add() in FieldSet



omermx
2 Sep 2009, 6:56 AM
Hi, I want to display a simple formatted text string in a fieldset. The fieldset initially contains a Menu TextItem, then later a function is called to remove this and add something else to the fieldset. For some reason when I try to add the new component and call .doLayout, the fieldset remains empty. Not sure where I'm going wrong here:

Initial config:



xtype:'fieldset',
id:'next_appt_fs',
title: 'Appointments Due',
collapsible: false,
autoHeight:true,
border:true,
items:[{
xtype:'menutextitem',
id:'recall_appointments_text',
text:'<b>Sight:</b>&nbsp;No Appointments&nbsp;',
cls:'textSize'
}]

The function called to update it:




function setAppointmentsDisplay()
{

var fs = Ext.getCmp('next_appt_fs');
fs.remove('recall_appointments_text');
fs.add({xtype:'textfield',hideLabel:true,value:'test'});
fs.doLayout();

}

omermx
2 Sep 2009, 7:35 AM
I think I was actually over complicating things!

Instead of using a Menu Text Item, I just used Fieldset.add({html:'text'}) which works fine.