ExtJS 4 - Mark a red asterisk on an required field

后端 未结 11 2270
长发绾君心
长发绾君心 2020-12-08 08:24

I have this problem where I need to add a red asterisk beside a fieldLabel when a field is marked as \"required\" (or allowBlank: false)

In

11条回答
  •  旧巷少年郎
    2020-12-08 08:39

    For Ext JS 4.1.1 this works:

    Ext.define('com.ideas.widgets.Base', {
        override : 'Ext.form.field.Base',
        initComponent : function()
        {
            if(this.allowBlank!==undefined && !this.allowBlank)
            {
                if(!this.labelSeparator)
                {
                    this.labelSeparator = "";
                }
                this.labelSeparator += '*';
            }
            this.callParent(arguments);
        }
    });
    

提交回复
热议问题