The CheckboxGroup in Extjs3.0 cannot dynamically add items by default. Although it inherits Ext. form. Field, it is similar to a container.
The items process in the CheckboxGroup configuration generates a corresponding panel. This process is performed only once, so it is difficult to dynamically Add the CheckboxGroup.
If you need to dynamically create data, try to create the entire CheckboxGroup instead of dynamically adding items.
Copy codeThe Code is as follows:
Var unitColumns = [];
For (var I = 0; I <records. length; I ++ ){
UnitColumns. push ({
BoxLabel: records [I]. data. A11,
Name: records [I]. data. A11,
InputValue: records [I]. data. A1,
Checked: false
});
}
Var itemsGroup = new Ext. form. CheckboxGroup ({
Id: 'unitids ',
BodyStyle: 'background-color: transparent; margin-top: 10px ;',
FieldLabel: 'options ',
Columns: 2,
Items: unitColumns
});
Ext. getCmp ('optionsset'). add (itemsGroup );
Ext. getCmp ('optionsset'). doLayout ();