1. #1
    Sencha User
    Join Date
    Oct 2011
    Location
    Mumbai
    Posts
    19
    Vote Rating
    0
    parth.suthar is on a distinguished road

      0  

    Question Add click listener to Toolbar.

    Add click listener to Toolbar.


    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.

  2. #2
    Sencha User
    Join Date
    Oct 2011
    Location
    Mumbai
    Posts
    19
    Vote Rating
    0
    parth.suthar is on a distinguished road

      0  

    Red face Handler property in Button can work as click listener

    Handler property in Button can work as click listener


    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.