Hello,
I yet don't understand how to properly access ext components, can someone enlighten me ?
Today I mainly uses this
Code:
var formSystem = Ext.getCmp('myForm');
How do I avoid that? see my code.
Problems:
1 - I only can use inline handler function, like panel button example, If I create a var for that function, my handler only can find it if it is declared before my handler call.
2 - I can't access my form or grid by their var 'name', only can using 'getCmp'.
Code:
var gridSistemas = Ext.create('Ext.grid.Panel',{
...
tbar: [
{ iconCls: 'btn-Ins', scope: this, tooltip: 'Insert', handler: insertFunc }
]
});
var formSystem = Ext.create('Ext.form.Panel',{
...
items: [{
buttons: [
{
id: 'btnSave', text: 'Save', scope: this,
handler: function () {
var formSystem = Ext.getCmp('myForm');
if (formSystem.isValid()) {
...
}
}
}]
}]
});
var insertFunc = function ()
{
//Here I need to access myForm
}
var saveFunc = function ()
{
//Here I need to access myForm
}
var myPanel = Ext.create('Ext.Panel',{
//Here I display my components
});
Thanks