PDA

View Full Version : findField by itemId for 'table' layout doesnt seem to work



vick_44
2 Jan 2017, 4:30 AM
I have this below form :



Ext.define('blahblah.view.PortView', {
extend: 'Ext.form.Panel',
header:false,
alias : 'widget.blahblah.view.PortView',
store : 'blahblah.store.PortStore',


border:false,
items:[{
text: 'Port Info',
style: 'font-weight:bold',
xtype:'label',
margin: '3 2 2 2',
labelSeparator: '',

},{
margin: '3 2 2 160',
border:false,
layout: {
type: 'table',
columns: 4
},
defaults: {
bodyStyle: 'padding:10px'
},
items: [{
html: 'Working',
id:'blahBlah',
style: 'text-align:center;',
width:160
},{
html: 'Spare',
style: 'text-align:center;',
width:160
},{
html: 'Total',
style: 'text-align:center;',
width:160
},{
html: 'Utilization',
style: 'text-align:center;',
width:160
},{
xtype: 'displayfield',
itemId: 'working',
fieldStyle: 'text-align: center;',
readOnly : true,
style: {
borderColor: 'black',
borderStyle: 'solid',
borderWidth: '1px'
},
width:160
},{
xtype: 'displayfield',
itemId: 'spare',
fieldStyle: 'text-align: center;',
readOnly : true,
style: {
borderColor: 'black',
borderStyle: 'solid',
borderWidth: '1px'
},
width:160
},{
xtype: 'displayfield',
itemId: 'total',
fieldStyle: 'text-align: center;',
readOnly : true,
style: {
borderColor: 'black',
borderStyle: 'solid',
borderWidth: '1px'
},
width:160
},{
xtype: 'displayfield',
itemId: 'utilization',
fieldStyle: 'text-align: center;',
readOnly : true,
style: {
borderColor: 'black',
borderStyle: 'solid',
borderWidth: '1px'
},
width:160
}]

}]
});




I am unable to get reference of the displayFields of above form,

the syntax which has worked for me before in other forms of my application is as below
(below code is put in controller under 'refs' )



this.getSearchForm().getForm().findField('someDisplayFieldItemId');


But the same doesnt seem to work for above form which is puzzling me. The only difference between my other form and PortView form is that the layout is defined as 'table'. Could that be the reason why the above syntax dont work for PortView form?... If yes any workaround that i can try?

I am able to get the reference for form with
this.getPortView().getForm() but findField with itemId just doesnt work. : (


Any help or pointers is appreciated.


thanks.

vick_44
4 Jan 2017, 2:37 AM
Instead of looking for how to get reference of table layout with findField(itemId), figured i could use global id in its stead


{
xtype: 'displayfield',
id: 'workingPort',
fieldStyle: 'text-align: center;',
readOnly : true,
style: {
borderColor: 'black',
borderStyle: 'solid',
borderWidth: '1px'
},
width:160
}


and use below syntax to get the reference.


Ext.getCmp('workingPort').setValue(500);