I have an issue populating checkbox group dynamically from database(MYSQL) in extjs 4. Below is the code i tried by searching forums. Please advise what needs to be done to get this working.
(i) I have an ArrayStore as below:
var checkboxArray1 = [];
var arrayStore= new Ext.data.ArrayStore({
autoLoad:false,
proxy: {
type: 'rest',
url: 'xxxxxxx',
reader: {
type: 'json',
root: 'doThisStore'
}
},
fields : ['vcName','vcId'],
listeners: {
load: function(t, records, options) {
for(var i = 0; i < records.length; i++) {
checkboxArray1.push({name: records[i].data.vcId, boxLabel: records[i].data.vcName});
alert(checkboxArray1[i].name);
alert(checkboxArray1[i].boxLabel);
}
}
}
});
(ii) I have 'fieldset' as below:
{
xtype : 'fieldset',
title : "Systems",
collapsed:false,
checkboxToggle: true,
anchor : '100%',
defaults : {
msgTarget : 'side',
allowBlank : true
},
items:{
xtype: 'checkboxgroup',
fieldLabel: 'dothis',
columns: 3,
vertical: true,
items: checkboxArray1
}},
Appreciate your help.