{ xtype: 'fieldset', id: 'distinguishs', border: false, layout: {align: 'middle',pack: 'center',type: 'hbox'}, defaultType: 'checkbox', items: [{ id: '11', name: 'distinguish', tabIndex: '5', boxLabel: '11', inputValue: '11' }, { id: '12', name: 'distinguish', tabIndex: '6', inputValue: '12', boxLabel: '12' }, { id: '13', name: 'distinguish', tabIndex: '7', inputValue: '13', boxLabel: '13', } ] } ========================= var xqCheck = Ext.getCmp('distinguishs').items; var ids = ''; for(var i = 0; i < xqCheck.length; i++){ if(xqCheck.get(i).checked){ ids += ',' + xqCheck.get(i).inputValue; } } if(ids.length > 0){ ids = ids.substr(1); Ext.MessageBox.alert('提示', '您的兴趣是' + ids); } ====================== { xtype: 'checkboxgroup', fieldLabel: 'Hobby', id: 'hobby', columns: 2, vertical: true, items: [ { boxLabel: 'music', name: 'rb', inputValue: '1', checked: true }, { boxLabel: 'sport', name: 'rb', inputValue: '2' }, { boxLabel: 'draw', name: 'rb', inputValue: '3' } ] } ==================== //获取通过checkboxgroup定义的checkbox值 var hobbyValue = Ext.getCmp('hobby').getChecked(); var hobby; Ext.Array.each(hobbyValue, function(item){ hobby += '+' + item.boxLabel; }); Ext.MessageBox.alert('提示', '您的兴趣是' + hobby); |
|