Javascript 如何在Ext JS textfield标签中用星号标记必填字段
我需要在扩展下面屏幕的屏幕中将allowBlank属性设置为false的多个表单字段添加红色星号。我在这里尝试过这个解决方案:但它不起作用。有什么方法可以在initComponent函数中添加功能吗Javascript 如何在Ext JS textfield标签中用星号标记必填字段,javascript,extjs,Javascript,Extjs,我需要在扩展下面屏幕的屏幕中将allowBlank属性设置为false的多个表单字段添加红色星号。我在这里尝试过这个解决方案:但它不起作用。有什么方法可以在initComponent函数中添加功能吗 Ext.define('APP.view.ux.visual.screen.UxClassicScreen', { extend: 'Ext.form.Panel', alias: 'widget.uxclassicscreen', config: { layout: 'vbox' },
Ext.define('APP.view.ux.visual.screen.UxClassicScreen', {
extend: 'Ext.form.Panel',
alias: 'widget.uxclassicscreen',
config: {
layout: 'vbox'
},
initComponent: function(){
var viewModel = this.getViewModel(),
controller = this.getController();
if(viewModel != null && controller != null){
viewModel.set('isKiosk', controller.isKiosk());
}
this.callParent();
}
});
要将此行为添加到所有字段,可以覆盖
Ext.form.field.Base
,例如:
Ext.define('MyApp.overrides.form.field.Base', {
override: 'Ext.form.field.Base',
initLabelable: function () {
this.callParent(arguments);
if (this.fieldLabel && this.allowBlank === false) {
this.labelSeparator += '<span class="mandatory">*</span>';
}
}
});
Ext.define('MyApp.overrides.form.field.Base'{
重写:“Ext.form.field.Base”,
initLabelable:函数(){
this.callParent(参数);
if(this.fieldLabel&&this.allowBlank==false){
this.labelSeparator+='*';
}
}
});
要将此行为添加到所有字段,可以覆盖Ext.form.field.Base
,例如:
Ext.define('MyApp.overrides.form.field.Base', {
override: 'Ext.form.field.Base',
initLabelable: function () {
this.callParent(arguments);
if (this.fieldLabel && this.allowBlank === false) {
this.labelSeparator += '<span class="mandatory">*</span>';
}
}
});
Ext.define('MyApp.overrides.form.field.Base'{
重写:“Ext.form.field.Base”,
initLabelable:函数(){
this.callParent(参数);
if(this.fieldLabel&&this.allowBlank==false){
this.labelSeparator+='*';
}
}
});