Search code examples
formsextjscheckboxextjs3fieldset

ExtJS - Dynamically add CheckBox to Form


I'm trying to dynamically add new form components to a fieldset inside a form and I'm struggling with the checkbox component.

I'm getting the "TypeError: Ext.form.Checkbox is not a constructor" error on firebug. Here's my code:

...
 Ext.getCmp('component1').add(new Ext.form.DisplayField({value: "aValue"}));
 Ext.getCmp('component1').doLayout();

 Ext.getCmp('component2').add(new Ext.form.Checkbox({fieldlabel:"aLabel",
                                     name: "aName"}));
 Ext.getCmp('component2').doLayout();
 ...

Both components (component1,component") are xtype:fieldset and look exactly the same. The first component, the DysplayField works correctly but the checkbox doesn't.

Can you help me? Thank you


Solution

  • you may need check the layout of component2. or compare the layout between component1 and component2. Try to set the layout as the same.