PDA

View Full Version : MenuItem click event problem with Ext Designer



gersonpr
23 Dec 2010, 11:01 AM
Hello there,

I'm testing ExtDesigner and some problems happened when i want add click event on MenuItem. :(( I obtain this javascript error:


Erro: this.itmClienteManter is undefined
Arquivo-fonte: file:///home/TTI1/gerson/programas/extjs-projects/Teste.js
Linha: 7


The strange is that the click event works fine on sigle button on the panel form. :-?
When uncomment line that add click event on menuitem, the application works!

My js files:

Teste.js


Teste = Ext.extend(TesteUi, {
initComponent: function() {
Teste.superclass.initComponent.call(this);
this.btTeste.on('click', this.btTestClickHandler, this);

//when i comment this line, the application works!
//this.itmClienteManter.on('click', this.itmClienteManterClickHandler, this);

},
btTestClickHandler: function() {
Ext.MessageBox.show({
title: 'Botão click handler',
msg: 'Aperte Sim:',
width:300,
buttons: Ext.MessageBox.YESNOCANCEL,
fn: function() { alert('Botão pressionado!'); }
});
},
itmClienteManterClickHandler: function() {
alert('Cliente Manter!');
}
});


Teste.ui.js



TesteUi = Ext.extend(Ext.form.FormPanel, {
title: 'Cadastro de Cliente',
width: 937,
height: 599,
padding: 10,
layout: 'vbox',
id: 'frmCliente',
initComponent: function() {
this.items = [
{
xtype: 'button',
text: 'Botao Teste',
ref: 'btTeste'
}
];
this.tbar = {
xtype: 'toolbar',
items: [
{
xtype: 'button',
text: 'Cliente',
ref: '../botao2',
id: 'btnMenuCliente',
menu: {
xtype: 'menu',
id: 'menuCliente',
items: [
{
xtype: 'menuitem',
text: 'Manter',
ref: '../../../itmClienteManter'
}
]
}
}
]
};
TesteUi.superclass.initComponent.call(this);
}
});