PDA

View Full Version : Add click listener to Toolbar.



parth.suthar
6 Oct 2011, 11:15 PM
Hello Friends,

I want to add click listener to Toolbar's items. My code is

var toolbar = new Ext.Toolbar({
layout:{type:'hbox',align:'top'},
width:'70px',
dock:'top',
draggable:true,
revert:true,
items:[
{
xtype:'button',
ui:'plain',
icon:'icons/White/home_white.png',
cls:'pressedCls-abc',
pressedCls:'pressedCls2',
listener:{
click:{
element:this.el, //bind to the underlying el property on the panel
fn: function(){ alert("df"); }

}
},


}
],
listeners:{
click:function()
{
alert("Df");
},
}

});


I don't know what to specify in 'element' property of listener config. I have added this.el and this.getEl(),but it gives me error. So what to specify in it.

parth.suthar
7 Oct 2011, 1:45 AM
I have found the way to handle click event in Button class.

Just add handler config like
handler:function(){//do some login}
will handle click event.

But still i donot know how to add click event using listener config and using addListener,on methods. According to example given in api docu. do not work.