用到了EXT中的radiogroup, 碰到了一些问题,
首先,radiogroup 不能动态添加item,也就是他包含的checkbox不能动态加载,只能动态的得到数据创建一个radiogroup,然后把他动态的加载到formpanel中去,
var cs = Classification.getClassificationStore(); var radioGroup; var csCombos = []; cs.on('load', function(store, records, option){ for(var i = 0; i < cs.getCount(); i++){ var cr = cs.getAt(i); var combo = new Ext.form.Checkbox({ boxLabel: cr.get("name"), name: cr.get("code"), inputValue: cr.get("name") }); csCombos[i] = combo; } radioGroup = new Ext.form.RadioGroup({ fieldLabel: '信息分类', id: 'classifications', defaultType: 'checkbox', vertical: true, columns: 3, items: csCombos }); panel.insert(3,radioGroup); }); cs.load();
?其次,在读取的时候不能getValue(显然)
读取方式:
var classificationRadioGroup = Ext.getCmp('classifications'); var classifications = ""; classificationRadioGroup.eachItem(function(item){ if(item.checked == true){ classifications += item.inputValue+";"; } });?