Extjs

[Extjs] RadioGroup 动态选中

2019-05-22  本文已影响0人  w_w_wei

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()
上一篇下一篇

猜你喜欢

热点阅读