PDA

View Full Version : checkboxgroup without items



kalan
15 Jun 2010, 2:05 AM
Good day,
I want to add items to CheckboxGroup dynamically, so when I create my form there are no items in the checkbox group. But when I try to create a checkbox group without any items, I get an error saying that 'this.items.0' is null.

my code is


var userRolesPanel = new Ext.FormPanel({
region: 'east',
width: '30%',
title: '<img src="../../Content/img/user_role.gif" /> ???????? ?????',
collapsible: true,
split: true,
items: {
id: 'myGroup',
xtype: 'checkboxgroup',
fieldLabel: 'Single Column',
columns: 1
// items: [{ boxLabel: 'Item 1', name: 'cb-col-1' },
// { boxLabel: 'Item 2', name: 'cb-col-2', checked: true },
// { boxLabel: 'Item 3', name: 'cb-col-3'}]
}
});

pavanextjs
15 Jun 2010, 6:08 AM
Try have an empty array initially when you create the CheckBoxGroup...


var userRolesPanel = new Ext.FormPanel({
region: 'east',
width: '30%',
title: '<img src="../../Content/img/user_role.gif" /> ???????? ?????',
collapsible: true,
split: true,
items: {
id: 'myGroup',
xtype: 'checkboxgroup',
fieldLabel: 'Single Column',
columns: 1
items: [] //Empty Array
}
});and add the checkboxes as you wish, you can follow the below post for adding then as reference.

http://www.extjs.com/forum/showthread.php?t=84109

muncher
20 Jul 2010, 9:04 AM
I don't think items:[] works !

Is there any other way ?



Try have an empty array initially when you create the CheckBoxGroup...


var userRolesPanel = new Ext.FormPanel({
region: 'east',
width: '30%',
title: '<img src="../../Content/img/user_role.gif" /> ???????? ?????',
collapsible: true,
split: true,
items: {
id: 'myGroup',
xtype: 'checkboxgroup',
fieldLabel: 'Single Column',
columns: 1
items: [] //Empty Array
}
});and add the checkboxes as you wish, you can follow the below post for adding then as reference.

http://www.extjs.com/forum/showthread.php?t=84109

muncher
20 Jul 2010, 9:28 AM
something of the sort works well



items: [new Ext.form.Checkbox({submitValue:false, hidden:true})]