Search code examples
javascriptextjsextjs3

extjs 3.4 how to dynamically add checkbox to toolbar


I have Panel with a BottomToolbar. I want to add and remove dynamically a checkbox/checkboxgroup or radio/radiogroup. I saw that we have the method addItem for Ext.Toolbar but the checkbox doesn't extends Item... Is there a way to accomplish this?

A preview of my code and what I want to achieve:

var myCheckboxGroup = new Ext.form.CheckboxGroup({
        id:'displayParamCheckGroup',
        xtype: 'checkboxgroup',
        columns: 1,
        items: checkboxArray
    });
Ext.getCmp('siteChartPanel').getBottomToolbar().add(myCheckboxGroup);

Solution

  • You have forgotten to call doLayout() method after adding:

    Ext.getCmp('siteChartPanel').getBottomToolbar().doLayout();