1. #1
    Sencha Premium Member
    Join Date
    Oct 2012
    Posts
    7
    Vote Rating
    1
    hemp is on a distinguished road

      0  

    Default Toolbar and overflowHandler: Controller/ComponentQuery best practice?

    Toolbar and overflowHandler: Controller/ComponentQuery best practice?


    In the arena of Toolbars, Buttons and the enableOverflow: true (overflowHandler: 'Menu') feature of a Toolbar:

    Does anyone have any suggestions to match both Buttons and MenuItems at the same time in the Controller? The query for the menuitem seems too generic and I would like to be more specific if possible.

    4.2.1 fidde: http://jsfiddle.net/hemp/vzSnG/

  2. #2
    Sencha - Support Team slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    5,079
    Vote Rating
    186
    slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold slemmon is a splendid one to behold

      0  

    Default


    This is what I came up with:

    Code:
    init: function () {
        this.control({
            'toolbar > button, button[id$="-menu-trigger"] > menuitem': {
                click: this.onClick
            }
        });
    }
    That's from looking at the cls applied to the overflow menu button which is undocumented and in a private class, so it's POSSIBLE that it could be changed in some future version (standard disclaimer).
    Are you a Sencha products veteran who has wondered what it might be like to work at Sencha? If so, please reach out to our recruiting manager: sheryl@sencha.com

    C
    heck out all of the 2013 SenchaCon presentations here:
    http://www.sencha.com/blog/senchacon...now-available/

  3. #3
    Sencha User makana's Avatar
    Join Date
    Apr 2008
    Location
    Dresden, Germany
    Posts
    527
    Vote Rating
    19
    makana has a spectacular aura about makana has a spectacular aura about

      0  

    Default


    I catched it long time ago and it's an open bug since 4.0.2.
    http://www.sencha.com/forum/showthread.php?145592

    But Ext.toolbar.Toolbar has the following code:
    Code:
        getRefItems: function(deep) {
            var me = this,
                items = me.callParent(arguments),
                layout = me.layout,
                handler;
    
            if (deep && me.enableOverflow) {
                handler = layout.overflowHandler;
                if (handler && handler.menu) {
                    items = items.concat(handler.menu.getRefItems(deep));
                }
            }
            return items;
        },
    Doesn't that work already?
    Programming today is a race between software engineers striving to build bigger and better Ń–diot-proof programs, and the universe striving to produce bigger and better idiots. So far, the universe is winning. (Rick Cook)

    Enhanced ExtJS adapter for Adobe AIR

  4. #4
    Sencha Premium Member
    Join Date
    Oct 2012
    Posts
    7
    Vote Rating
    1
    hemp is on a distinguished road

      0  

    Default


    Yeah the controller bug you reported does still exist in 4.2.1.

    I was just curious what folks did in general. I think @slemmon approach works for me for now. This is one of those things I've had on my TODO list to clean up though I'm not sure there is a good solution right now.

Thread Participants: 2