zoukankan      html  css  js  c++  java
  • ExtJS表单组件RadioGroup属性用法(选中初始值、表单加载,选中取值)的要点

    解决表单加载初始值,自动选中单选按钮组的问题,今早才查到资料,原来ext3.1已经修正了这个问题,但是需要的是给组和里面的单选按钮都要设置同样的name属性,我就是没有设定group的name,就悲剧了,这样设置即可: 

    Js代码  收藏代码
    1. {    
    2.    xtype: 'radiogroup',  
    3.    fieldLabel: 'Auto Layout',  
    4.    name: 'rb-auto'
    5.    id:'atype', 
    6.    items: [          
    7. {boxLabel: 'Item 1', name: 'rb-auto', inputValue: 1},         
    8. {boxLabel: 'Item 2', name: 'rb-auto', inputValue: 2, checked: true},          
    9. {boxLabel: 'Item 3', name: 'rb-auto', inputValue: 3},          
    10. {boxLabel: 'Item 4', name: 'rb-auto', inputValue: 4},         
    11. {boxLabel: 'Item 5', name: 'rb-auto', inputValue: 5}      
    12. ]    
    13. }   
    获取单选按钮的值的代码: var atype = Ext.getCmp('atype').getValue(); 
    他的弹出值是[object Object],我查了JS基础,说是为空或者不是对象 
    我的需求是:我要知道用户选了单选还是多选的按钮,我需要得到值。
    取值方法:
    1.  buttons:[{  
    2.       text:'xx',  
    3.       handler:function(){  
    4.         var rg = Ext.getCmp('atype');  
    5.         var r = rg.getValue();  
    6.         //关键  
    7.         var value = r.inputValue;  
    8.         alert(value) ;       
    9.       }  
    10.     }]  
  • 相关阅读:
    CH1301 邻值查找【set应用】
    poj1185 炮兵阵地【状压DP】
    codeforces#516 Div2---ABCD
    2017ACM-ICPC沈阳区域赛
    poj2411 Mondriaan's Dream【状压DP】
    hdu2196 Computer【树形DP】【换根法】
    poj3345 Bribing FIPA【树形DP】【背包】
    poj1463 Strategic game【树形DP】
    poj1191 棋盘分割【区间DP】【记忆化搜索】
    CH5E09 能量相连【区间DP】
  • 原文地址:https://www.cnblogs.com/ljian/p/2185826.html
Copyright © 2011-2022 走看看