problem about required-field-Record and share programming errors


  • Jonas
    forms extjs extjs4 required-field
    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 ExtJS3, we can have this hack easily by overriding Ext.layout.FormLayout as follow:Ext.override(Ext.layout.FormLayout, {getTemplateArgs: function(field) {var noLabelSep = !field.fieldLabel || field.hideLabel;var labelSep = (typeof field.labelSeparator == ‘undefined’ ? this.labelSeparator : field.labelSeparator);if (!field.allowBlank) labelSep += ‘*’;return {id: field.id,label: field.fieldLabel,labelStyle: field.labelStyle||this.labelStyle||”,elementStyle: this.elementStyle||”,labelSeparator: noLabelSep ? ” : labelSep,itemCls: (field.itemCls||this.container.itemCls||”) + (field.hideLabel ? ‘ x-hide-label’ : ”),clearCls: field.clearCls || ‘x-form-clear-left’};} });But this is impossible in ExtJS4. FormLayout is no longer applicable, and labels are in fact rendered by Ext.form.field.Base by using a mixins call

Originally posted 2013-10-23 19:28:14.