Results 1 to 9 of 9

Thread: Panel tools click event

  1. #1
    Ext JS Premium Member gevik's Avatar
    Join Date
    May 2009
    Location
    The Netharlands
    Posts
    277

    Question Panel tools click event

    In the following example the click event defined using "listeners" does not work. Only the event defined using the "handler" property gets called.
    Can anyone clarify this. Is this the default behavior or the example I provided is wrong to begin with.

    Code:
    new Ext.Panel({
        title:'test',
        width:100,
        height:100,
        renderTo:Ext.getBody(),
        tools:[
            new Ext.Button(
                {
                    id:'save',
                    //handler:function(sender){alert(0)},
                    listeners:{
                        click:function(sender){alert(1)}
                    }
                }
            )
        ]
    })
    ;

  2. #2

  3. #3
    Sencha User
    Join Date
    Sep 2009
    Location
    Calgary, Alberta, Canada
    Posts
    638

    Post

    Do you mean to say that if you have both the handler and the listener, that only the handler gets called? This is true, a handler terminates the event. If you need to have multiple function calls, just add multiple click events in the listener.

  4. #4
    Ext JS Premium Member gevik's Avatar
    Join Date
    May 2009
    Location
    The Netharlands
    Posts
    277

    Default

    Quote Originally Posted by CrazyEnigma View Post
    Do you mean to say that if you have both the handler and the listener, that only the handler gets called? This is true, a handler terminates the event. If you need to have multiple function calls, just add multiple click events in the listener.
    Oh no. the "listener" click event does not get called at all even if I comment the "handler" property.

  5. #5
    Sencha User
    Join Date
    Sep 2009
    Location
    Calgary, Alberta, Canada
    Posts
    638

    Post

    The handler use the click event. Check out the API. Ahh, but it is categorized under tools, which is not a button. Check out the API for that, and the exposed parameters are: function(event, toolEl, panel)

    These are just tools for you panel to be manipulated. If you want tools, you should use tbar or bbar (top toolbar/ bottom toolbar)
    Last edited by CrazyEnigma; 8 Jan 2010 at 9:10 AM. Reason: Clarification

  6. #6
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,892

    Default

    Yes. I pointed out the answer. There are no listeners. These are not Components, just specialized, clickable elements.

  7. #7
    Ext JS Premium Member gevik's Avatar
    Join Date
    May 2009
    Location
    The Netharlands
    Posts
    277

    Default

    I get it now. Thanx eveyone

  8. #8
    Sencha User
    Join Date
    Sep 2009
    Location
    Calgary, Alberta, Canada
    Posts
    638

    Default

    Hey Animal, your post didn't show up on my screen.

  9. #9
    Sencha User Animal's Avatar
    Join Date
    Mar 2007
    Location
    Bédoin/Nottingham
    Posts
    30,892

    Default

    Maybe you have me on your ignore list!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •