Extjs4 在FormPanel中使用formLabel进行本地化
我试图在一个面板中实现本地化,所以为了使fieldLabel可以从另一个文件访问,我定义它如下Extjs4 在FormPanel中使用formLabel进行本地化,extjs4,Extjs4,我试图在一个面板中实现本地化,所以为了使fieldLabel可以从另一个文件访问,我定义它如下 Ext.define('Ext.app.detailForm', { extend: 'Ext.form.Panel', id: 'cscForm', // frame: true, uncomment this to show blue frame background title: 'CSC Details :',
Ext.define('Ext.app.detailForm', {
extend: 'Ext.form.Panel',
id: 'cscForm',
// frame: true, uncomment this to show blue frame background
title: 'CSC Details :',
//trying
cscCode: 'CSC Code',
bodyPadding: 5,
layout: 'anchor', // Specifies that the items will now be arranged in columns
autoScroll: true,
//width:1200,
//height: 300,
collapsible: true,
fieldDefaults: {
labelAlign: 'left',
msgTarget: 'side'
},
items: [{
columnWidth: 0.4,
xtype: 'container',
layout:'anchor',
defaults: {
labelWidth: 150
},
defaultType: 'textfield',
items: [{
xtype: 'container',
layout: 'hbox',
items:[{
xtype: 'fieldset',
columnWidth:1.5,
layout: 'column',
width:1050,
defaultType: 'textfield',
defaults: {
labelWidth: 150,
margin: '3 0 0 10'
},
items: [{
fieldLabel: this.cscCode,
name: 'CSCCode',
width: 500
}, {.....
但是当我尝试渲染这个面板时,cscCode的formLabel不会显示,这里是否有我做错的事情
我基本上无法访问“this.cscCode”您应该在
initComponent
函数中定义项目数组,而不是作为数组属性。
在数组属性中定义this.cscCode
时,此的作用域错误
Ext.define('Ext.app.detailForm', {
extend: 'Ext.form.Panel',
id: 'cscForm',
// frame: true, uncomment this to show blue frame background
title: 'CSC Details :',
//trying
cscCode: 'CSC Code',
bodyPadding: 5,
layout: 'anchor', // Specifies that the items will now be arranged in columns
autoScroll: true,
//width:1200,
//height: 300,
collapsible: true,
fieldDefaults: {
labelAlign: 'left',
msgTarget: 'side'
},
initComponent: function() {
this.items = [{
columnWidth: 0.4,
xtype: 'container',
layout:'anchor',
defaults: {
labelWidth: 150
},
defaultType: 'textfield',
items: [{
xtype: 'container',
layout: 'hbox',
items:[{ .....
items: [{
fieldLabel: this.cscCode,
name: 'CSCCode',
width: 500
}, {.....
}]
this.callParent(arguments);
}