PDA

View Full Version : Panel click event



arvindwill
30 Nov 2012, 2:59 AM
Since panel dont have click event cant able to attach listeners in mvc style. What is the equivalent way to achieve panel click event in MVC design

vietits
30 Nov 2012, 5:01 AM
Try this:

1. View code


Ext.define('App.view.Panel', {
extend: 'Ext.panel.Panel',
alias: 'widget.apppanel',
bodyCls: 'entity_draw',
...
listeners: {
click: {
element: 'el',
fn: function(){
var panel = Ext.getCmp(this.id);
panel.fireEvent('click'); // fire 'click' event from panel
}
}
}
});

2. Controller


...
init: function(){
this.control({
'apppanel': { // 'panel[bodyCls=entity_draw]'
click: function(){
console.log('panel is clicked');
}
}
});
}