[EXT] radio 控件setValue后事件丢失的bug

2019-11-27  本文已影响0人  w_w_wei

测试环境:Extjs 3.1.1

手动调用 setValue 事件,绑定的check事件丢失

解决方案 重写 setValue 方法
放在创建之前, 即可生效

Ext.override(Ext.form.Radio, {
    setValue : function(v) {
        if (typeof v == 'boolean') {
            Ext.form.Radio.superclass.setValue.call(this, v);
        } else if (this.rendered) {
            var els = this.getCheckEl().select('input[name=' + this.el.dom.name + ']');
            els.each(function(el){
                if (el.dom.value == v) {
                    Ext.getCmp(el.dom.id).setValue(true);
                } else {
                    Ext.getCmp(el.dom.id).setValue(false);
                }
            }, this);
        }
        return this;
    }
});
上一篇 下一篇

猜你喜欢

热点阅读