aaronwong_best 2009-08-13 11:14
浏览 228
已采纳

EXT3.0单选按钮取值问题

{
xtype: 'radiogroup',
id : 'atype',
fieldLabel: "选项类型",
items : [
{
boxLabel: '单选',
name: 'sur_atype',
inputValue:'sing',
checked : true
},
{
boxLabel: '多选',
name: 'sur_atype',
inputValue:'dou'
}
]
},
以上是我定义的单选按钮的组件
以下是我获取单选按钮的值的代码: var atype = Ext.getCmp('atype').getValue();
他的弹出值是[object Object],我查了JS基础,[color=red]说是为空或者不是对象[/color]
[color=red]我的需求是:我要知道用户选了单选还是多选的按钮,我需要得到值[/color],希望哪位仁兄帮我下,随便说下小妹的犯错地方,谢谢!!!

  • 写回答

1条回答 默认 最新

  • iteye_10013 2009-08-13 11:24
    关注

    可怜的毛毛...

    在试下我这段代码吧...
    inputValue,这次肯定对了..

    [code="javascript"]
    Ext.onReady(function(){
    Ext.BLANK_IMAGE_URL = '/images/s.gif';
    Ext.QuickTips.init();
    testForMaoMao();
    });
    function testForMaoMao(){
    var f = new Ext.form.FormPanel({
    width:300,
    height:300,
    renderTo:Ext.getBody(),
    items:[{
    xtype: 'radiogroup',
    id : 'atype',
    fieldLabel: "选项类型",
    items : [{
    boxLabel: '单选',
    name: 'sur_atype',
    inputValue:'sing',
    checked : true
    },{
    boxLabel: '多选',
    name: 'sur_atype',
    inputValue:'dou'
    }]
    }],
    buttons:[{
    text:'xx',
    handler:function(){
    var rg = Ext.getCmp('atype');
    var r = rg.getValue();
    //关键
    var value = r.inputValue;
    alert(value)
    //console.log(rg,r,value)
    }
    }]
    })
    }[/code]

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!
  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?