Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何在Ext JS textfield标签中用星号标记必填字段_Javascript_Extjs - Fatal编程技术网

Javascript 如何在Ext JS textfield标签中用星号标记必填字段

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' },

我需要在扩展下面屏幕的屏幕中将allowBlank属性设置为false的多个表单字段添加红色星号。我在这里尝试过这个解决方案:但它不起作用。有什么方法可以在initComponent函数中添加功能吗

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+='*';
}
}
});