ExtJS 获取radioGroup及CheckboxGroup值
2015-11-05 22:37
519 查看
/*! * Ext JS Library 3.3.0 */ Ext.onReady(function(){ Ext.QuickTips.init(); Ext.form.Field.prototype.msgTarget = 'side'; /*==================================================================== * RadioGroup examples *====================================================================*/ var radioGroup = { xtype: 'fieldset', title: 'Radio Groups', autoHeight: true, items: [{ xtype: 'radiogroup', fieldLabel: 'Auto Layout', items: [ {boxLabel: 'A', name: 'rb-auto', inputValue: 'A'}, {boxLabel: 'B', name: 'rb-auto', inputValue: 'B', checked: true}, {boxLabel: 'C', name: 'rb-auto', inputValue: 'C'}, {boxLabel: 'D', name: 'rb-auto', inputValue: 'D'}, {boxLabel: 'E', name: 'rb-auto', inputValue: 'E'} ] }] }; /*==================================================================== * CheckGroup example *====================================================================*/ var checkGroup = new Ext.form.CheckboxGroup({ xtype: 'checkboxgroup', fieldLabel: 'Auto Layout', items: [ {boxLabel: 'A', name: 'A' }, {boxLabel: 'B', name: 'B' , checked: true}, {boxLabel: 'C', name: 'C' }, {boxLabel: 'D', name: 'D' }, {boxLabel: 'E', name: 'E' } ] }); var fp = new Ext.FormPanel({ title: 'Check/Radio Groups Example', frame: true, labelWidth: 110, width: 600, renderTo:'form-ct', bodyStyle: 'padding:0 10px 0;', items: [radioGroup,checkGroup], buttons: [{ text: 'RadioGroup', handler: function(){ alert(fp.getForm().getValues()["rb-auto"]); alert(fp.getForm().findField("rb-auto").getGroupValue()); } },{ text: 'CheckBoxGroup', handler: function(){ var ids = []; var cbitems = checkGroup.items; for (var i = 0; i < cbitems.length; i++) { if (cbitems.itemAt(i).checked) { ids.push(cbitems.itemAt(i).name); } } alert(ids); } }] }); });
相关文章推荐
- js 闭包
- mac 程序 Access-JSON-Data
- cJSON 库的使用和优化
- Javascript中的原型链
- js中的|| 与 &&
- jsp forward与redirect比较
- js正则表达式
- js setTimeout 和 setInterval实现多线程
- javascript中对象的深度克隆
- 达内学习日志Day46:Servlet+Jsp(准备工作)
- 达内学习日志Day46:Servlet+Jsp(介绍)
- 初探 Ext JS 6 (sencha touch/ext升级版)
- Javascript 学习 笔记三
- Javascript 学习 笔记三
- 贪吃蛇游戏实战学习JS
- JSON和JSONP
- JS---正则表达式练习
- jsp页面弹出For input string:""
- cjson不连续存储问题
- js异常处理