[Ext重写]必填项的label后面加星号

Ext.form.TextField.override({
                initComponent: Ext.form.TextField.prototype.initComponent.createInterceptor(function(){
                    if (this.allowBlank === false && this.fieldLabel) {
                        this.fieldLabel += '<font color=red>*</font>';
                    }
                })
            });

所有的输入项如果配置了allowBlack 为false,它的label后面就都会有红星号了,方便日后统一修改, 注意:方法重写的代码最好放到onReady函数上面

你可能感兴趣的:(ext,prototype)