I am trying to call 'ControlFocus' method from drop down focus event but it gives me error. I know it is some scoping issue but not sure how to do it.
So basically structure is as follow:
Ext.define('Panel', {
extend: 'Ext.Panel.panel',
items: [
{
xtype: 'container',
items: []
},
{
xtype: 'fieldcontainer',
itemId: 'namefields',
items[]
},
{
xtype: 'fieldcontainer',
itemId: 'namefieldsRow2',
items: []
},
],
controlFocus: function(field) {
// I want to use this function in several controls
}
});
Actual code
Ext.define('Panel', {
extend: 'Ext.Panel.panel',
items: [
{
xtype: 'hiddenfield',
name: 'ID',
itemId: 'id',
value: 0
},
{
xtype: 'container',
style: 'padding: 18px 0 10px 0;',
defaults: {
padding: '0 10 0 0',
style: 'padding-left: 0;'
},
items: [
{
name: 'ExportCode',
xtype: 'hiddenfield'
},
{
fieldLabel: 'BusinessStructure'),
name: 'BusinessStructureId',
itemId: 'BusinessStructureId',
lookupName: 'Structure',
xtype: 'combo',
id: 'BusinessStructureId',
listeners: {
change: function(field) {
},
focus:function(combo, e, opts){
},
// scope: this, // not working
blur: function(field,ev) {
},
},
},
{
fieldLabel: 'ClientType',
name: 'ClientTypeId',
itemId: 'ClientTypeId',
lookupName: 'ClientType',
xtype: 'combo',
},
]
},
{
xtype: 'fieldcontainer',
itemId: 'namefields',
layout: 'hbox',
fieldDefaults: {
labelCls: 'h-bold'
},
cls: 'u-hr-bottom-light',
items: [
{
fieldLabel:'Name'),
labelClsExtra: 'x-form-item-label x-required',
name: 'Name',
itemId: 'Name',
xtype: 'textfield',
fieldCls: 'big',
width: 650,
listeners: {
focus: function(field, ev) {
},
blur: function(field,ev) {
},
}
},
{
fieldLabel: 'FirstName'),
labelClsExtra: 'x-form-item-label x-required',
name: 'FirstName',
itemId: 'FirstName',
xtype: 'textfield',
listeners: {
focus: function(field) {
},
blur: function(field, ev) {
},
}
},
]
},
{
xtype: 'fieldcontainer',
itemId: 'namefieldsRow2',
claims: [req.pm, req.au, req.autax],
layout: 'hbox',
fieldDefaults: {
labelCls: 'h-bold'
},
cls: 'u-hr-bottom-light',
items: [
{
fieldLabel: 'ClientTitle',
name: 'Title',
itemId: 'Title',
xtype: 'editablecombo',
},
]
},
],
controlFocus: function(field) {
// I want to use this function in several controls
}
});