美文网首页Extjs
[Extjs] RadioGroup 动态选中

[Extjs] RadioGroup 动态选中

作者: w_w_wei | 来源:发表于2019-05-22 10:37 被阅读0次

RadioGroup 定义如下:

{
            fieldLabel:tr('门户类别'),
            xtype:'radiogroup',
            id:'strategyType',
            items: [{
                name :'type',
                inputValue: 'local',
                boxLabel: tr('本地门户'),
                checked: true
            },{
                name :'type',
                inputValue: 'thirdparty',
                boxLabel: tr('第三方门户')
            }]
}

初始化时默认,会选中 本地门户, 因为 checked: true.
如果需要动态选中 第三方门户:

Ext.getCmp('strategyType').items.get(1).setValue(true);

另外一个问题就是,这个方法会导致,radiogroup上监听的事件消失,
最后,通过click方法解决了,绑定事件消失的问题

Ext.getCmp('strategyType').items.get(1).el.dom.click()

相关文章

网友评论

    本文标题:[Extjs] RadioGroup 动态选中

    本文链接:https://www.haomeiwen.com/subject/upkyzqtx.html