[英]How can i use same xtype multiple time within same panel Extjs 4.2?
May be my ques is basic thing in Extjs 4.2 I need to use same xtype (which is a view) to be re-used multiple time in same page. 可能是我的问题是Extjs 4.2中的基本问题,我需要使用相同的xtype(这是一个视图)才能在同一页面中多次使用。 My part of code 我的部分代码
this panel where i need to call the xtype multiple times. 该面板需要多次调用xtype。
{
xtype : 'panel',
title : 'Payment Received at this Nostro Account',
flex : 2,
layout : {
type : 'anchor'
},
items : [
{
xtype: 'label',
forId: 'pymntRcvdNostroIntermediary',
text: 'Intermediary',
margins: '0 0 0 10'
},
{
xtype : 'settlementInstitution',
id : 'settlementInstitution',
cls : 'settlementInstitution',
},
{
xtype: 'label',
forId: 'pymntRcvdNostroBenBank',
text: 'Benificiary Bank',
margins: '0 0 0 60'
},
{
xtype : 'settlementInstitution',
id : 'settlementInstitution',
cls : 'settlementInstitution',
},
{
xtype: 'label',
forId: 'pymntRcvdNostroBen',
text: 'Benificiary',
margins: '0 0 0 120'
},
{
xtype : 'settlementInstitution',
id : 'settlementInstitution',
cls : 'settlementInstitution',
}
This is the xtype (Same view to be used multiple times) 这是xtype(多次使用相同的视图)
Ext.define('settlementInstitution', {
extend: 'Ext.panel.Panel',
height:'100%',
width: '100%',
//style: 'border: solid #FFFFFF 1px',
alias: 'widget.settlementInstitution',
items : [{
xtype : 'radiogroup',
id : 'radioPymtSentNostroOption',
fieldLabel : '',
flex: 1,
columns : 2,
columnWidth : 2,
vertical : true,
items : [
{
boxLabel : 'A',
name : 'radioPymtSentNostroChoice',
inputValue : 'A',
id : 'radioPymtSentNostroA'
},
{
boxLabel : 'D',
name : 'radioPymtSentNostroChoice',
inputValue : 'A',
id : 'radioPymtSentNostroD'
}
],
listeners : {
change : function(field, newValue, oldValue) {
var choice = newValue.radioPymtSentNostroOption;
if (Ext.isArray(choice)) {
return;
}
if (choice == "A") {
Ext.getCmp('pymtSentNostroPartyId').setVisble(true);
Ext.getCmp('pymtSentNostroBic').setVisble(true);
Ext.getCmp('pymtSentNostroName').setVisble(false);
Ext.getCmp('pymtSentNostroAddress1').setVisble(false);
Ext.getCmp('pymtSentNostroAddress2').setVisble(false);
Ext.getCmp('pymtSentNostroAddress3').setVisble(false);
}
if (choice == "D") {
Ext.getCmp('pymtSentNostroPartyId').setVisble(false);
Ext.getCmp('pymtSentNostroBic').setVisble(false);
Ext.getCmp('pymtSentNostroName').setVisble(true);
Ext.getCmp('pymtSentNostroAddress1').setVisble(true);
Ext.getCmp('pymtSentNostroAddress2').setVisble(true);
Ext.getCmp('pymtSentNostroAddress3').setVisble(true);
}
}
}
},
{
name : 'pymtSentNostroPartyId',
xtype : 'textfield',
fieldLabel : 'Party Id',
labelSeparator : '',
margin : '15 0 10 3',
maxLength : 20,
enableKeyEvents:true,
id : 'pymtSentNostroPartyId',
enforceMaxLength : 20,
},
{
name : 'pymtSentNostroBic',
xtype : 'textfield',
fieldLabel : 'BIC',
labelSeparator : '',
margin : '15 0 10 3',
maxLength : 10,
enableKeyEvents:true,
id : 'pymtSentNostroBic',
enforceMaxLength : 10,
},
{
name : 'pymtSentNostroName',
xtype : 'textfield',
fieldLabel : 'Name',
labelSeparator : '',
margin : '15 0 10 3',
maxLength : 10,
enableKeyEvents:true,
id : 'pymtSentNostroName',
enforceMaxLength : 10,
},
{
name : 'pymtSentNostroAddress1',
xtype : 'textfield',
fieldLabel : 'Address',
labelSeparator : '',
margin : '15 0 10 3',
maxLength : 30,
enableKeyEvents:true,
id : 'pymtSentNostroAddress1',
enforceMaxLength : 30,
},
{
name : 'pymtSentNostroAddress2',
xtype : 'textfield',
labelSeparator : '',
margin : '15 0 10 3',
maxLength : 30,
enableKeyEvents:true,
id : 'pymtSentNostroAddress2',
enforceMaxLength : 30,
},
{
name : 'pymtSentNostroAddress3',
xtype : 'textfield',
labelSeparator : '',
margin : '15 0 10 3',
maxLength : 30,
enableKeyEvents:true,
id : 'pymtSentNostroAddress3',
enforceMaxLength : 30,
}
]
});
I think you just have to have unique id
for each xtype
,It should work like below.For these two i have changed id to settlementInstitution1
&& settlementInstitution2
respectively. 我认为你必须有unique id
为每个xtype
,它应该像below.For这两个我已经改变ID来settlementInstitution1
&& settlementInstitution2
分别。
{
xtype : 'settlementInstitution',
id : 'settlementInstitution1',
cls : 'settlementInstitution',
},
{
xtype : 'settlementInstitution',
id : 'settlementInstitution2',
cls : 'settlementInstitution',
},
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.