Code:
Ext.application({
name : 'Fiddle',
launch : function() {
Ext.define('AddedMyGroup', {
extend: 'Ext.form.CheckboxGroup',
xtype: 'myGroupAdded',
labelAlign: 'top',
fieldLabel: 'Added Columns',
// Arrange checkboxes into two columns, distributed vertically
columns: 2,
vertical: true,
allowBlank: false,
invalidCls: 'invalid-form-entry',
border: 1,
style: {
borderColor: 'white',
borderStyle: 'solid'
},
initComponent: function() {
this.callParent();
this.add([
{ boxLabel: 'Item 1', name: 'rb', inputValue: '1' },
{ boxLabel: 'Item 2', name: 'rb', inputValue: '2', checked: true },
{ boxLabel: 'Item 3', name: 'rb', inputValue: '3'},
{ boxLabel: 'Item 4', name: 'rb', inputValue: '4' },
{ boxLabel: 'Item 5', name: 'rb', inputValue: '5' },
{ boxLabel: 'Item 6', name: 'rb', inputValue: '6' }
]);
this.validate();
}
});
Ext.define('NotAddedMyGroup', {
extend: 'Ext.form.CheckboxGroup',
xtype: 'myGroupNotAdded',
fieldLabel: 'Not Added Columns',
// Arrange checkboxes into two columns, distributed vertically
columns: 2,
labelAlign: 'top',
vertical: true,
allowBlank: false,
invalidCls: 'invalid-form-entry',
border: 1,
style: {
borderColor: 'white',
borderStyle: 'solid'
},
items: [
{ boxLabel: 'Item 1', name: 'rb', inputValue: '1' },
{ boxLabel: 'Item 2', name: 'rb', inputValue: '2', checked: true },
{ boxLabel: 'Item 3', name: 'rb', inputValue: '3'},
{ boxLabel: 'Item 4', name: 'rb', inputValue: '4' },
{ boxLabel: 'Item 5', name: 'rb', inputValue: '5' },
{ boxLabel: 'Item 6', name: 'rb', inputValue: '6' }
]
});
Ext.create('Ext.form.Panel', {
title: 'Checkbox Group',
bodyPadding: 10,
renderTo: Ext.getBody(),
height: 400,
defaults: {
flex: 1
},
layout: {
type: 'hbox',
align: 'stretch'
},
listeners: {
validitychange: function(form, isValid) {
console.log('validitychange', isValid);
}
},
items:[{
xtype: 'myGroupAdded',
reference: 'myGroupAdded'
}, {
xtype: 'myGroupNotAdded',
reference: 'myGroupNotAdded'
}]
});
}
});