PDA

View Full Version : how to create focus event for xtype element



sandy52
18 Feb 2014, 1:18 AM
Hi,
I am unable to create focus event of xtype element, i tried to create listener and create focus event but not working, also tried for click and double click event single click working good but double click work with single click. my code is :

items: [
{
xtype: 'MainNavigation', flex: 0, region: 'west', width: 65, margin: -5, height: 60, bodyStyle: 'background: #2B2B2B !important;border-bottom:2px solid #000 !important;border-style:solid;Height:45px;left:15px ',
listeners: {
el: {
click: function () {
var NavPanel;
//if (!this.NavPanel) {
this.NavPanel = Ext.widget('NavList');


//}
if (this.NavPanel.isVisible()) {
this.NavPanel.hide();
// this.NavPanel = null;
} else {
this.NavPanel.show();
this.NavPanel.setPosition(58,15,false);
}


console.log('single click...');
},
dblclick: function () {
//if (this.NavPanel.isVisible()) {
// this.NavPanel.hide();
// //this.NavPanel = null;
//}
var viewPort = Ext.ComponentQuery.query('viewport')[0];
var t = viewPort.getLayout().setActiveItem(0);
console.log('double click...');
}
}
}]

pls help me out.

Thanks & Regards,
sandeep

mitchellsimoens
3 Mar 2014, 7:39 AM
If you need to attach a listener on the element, one way you can do it is via:


new Ext.Component({
renderTo : document.body,
html : '<input type="text" />',
listeners : {
element : 'el',
delegate : 'input',
click : function() {
console.log('click');
}
}
});

sandy52
3 Mar 2014, 8:05 PM
Thanks