ITeye博客

extjs 修改checkboxgroup源代码--设置单个选项置灰

icrwen · 2010-11-18 13:16 · Extjs · Web前端 · HTML · EXT · IE · Markdown

Ext.override(Ext.form.CheckboxGroup,{ setItemDisable:function(id,disabled ) { this.items.each(function(item) { if(item.getName() == id) { item.setDisabled(disabled); } }); } });

Ext.override(Ext.form.Checkbox,{ onRender : function(ct, position){ Ext.form.Checkbox.superclass.onRender.call(this, ct, position); if(this.inputValue !== undefined){ this.el.dom.value = this.inputValue; } this.wrap = this.el.wrap({cls: 'x-form-check-wrap'}); if(this.boxLabel){ this.labelelment = this.wrap.createChild({tag: 'label', htmlFor: this.el.id, cls: 'x-form-cb-label', html: this.boxLabel}); } if(this.checked){ this.setValue(true); }else{ this.checked = this.el.dom.checked; } // Need to repaint for IE, otherwise positioning is broken if(Ext.isIE){ this.wrap.repaint(); } this.resizeEl = this.positionEl = this.wrap; } }); Ext.override(Ext.form.CheckboxGroup,{ setItemDisable:function(id,disabled ) { this.items.each(function(item) { if(item.getName() == id) { item.setDisabled(disabled); } }); }, setItemValue:function(index,blabel,value) { var i = -1; this.items.each(function(item){ i++; if(i == index) { item.boxLabel = blabel; Ext.get(item.labelelment.id).dom.innerHTML = blabel; item.setValue(value); } }); this.doLayout(); }, setCheckDisable:function(index,disabled) { var i = -1; this.items.each(function(item){ i++; if(i == index) { item.setDisabled(disabled); } }); }

});

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。