PDA

View Full Version : Event handler for HTML button



webfriend13
26 Jun 2012, 1:26 AM
HI All,

I am using ExtJs 4.1. I have a view which contains a button and a tab panel. The tab panel have two tabs. On click of button, I load the data into one of the tab. While data is loading into the tab, I am showing mask over the tab using tab.setLoading().



Ext.define('MyProject.DefaultController',
{
id: 'DefaultController',
extend: 'Ext.app.Controller',

init: function () {
this.control({
'defaultview #btn-getData': {
click: this.onBtnData
}
});
},
onBtnData: function () {
var tab = Ext.getCmp("my-tab");
tab.getEl().mask('<input type="button" value="Cancel" />');
tab.setLoading('');
}
});



I am showing a bttuon in the mask using tab.getEl().mask('<input type="button" value="Cancel" />');

I want to add a event handler function for the cancel button in the mask. So when user clicks on the cancel button, system should call the required function.

mitchellsimoens
6 Jul 2012, 2:06 PM
Controllers can only listen for component events not element events. You will need to listen to it in the view