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]

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

报告相同问题?

悬赏问题

  • ¥35 平滑拟合曲线该如何生成
  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
  • ¥15 名为“Product”的列已属于此 DataTable
  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
  • ¥50 成都蓉城足球俱乐部小程序抢票
  • ¥15 yolov7训练自己的数据集