Results 1 to 4 of 4

Thread: Getting a toolbar's overflow menu

  1. #1
    Sencha User BulletzBill's Avatar
    Join Date
    Mar 2010
    Location
    New York
    Posts
    138
    Vote Rating
    1
      0  

    Default Getting a toolbar's overflow menu

    Is there a way to get the Ext.menu and/or the Ext.Button components used for the overflow menu and "more button" respectively on a Ext.toolbar that has enableOverflow:true?

    I tried attaching a listener to the toolbar's 'overflowchange' event to see if I could use query() or getComponent() to find the button/menu when it was being shown, but that event does not seem to fire when resizing the toolbar to cause the overflow menu to appear/disappear. I also monitored the toolbar's 'add' event to see if that was fired when the "more" button was added to the toolbar, but no luck there either.

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,556
    Vote Rating
    1272
      0  

    Default

    The menu is held at toolbar.layout.overflowHanlder.menu
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  3. #3
    Sencha User BulletzBill's Avatar
    Join Date
    Mar 2010
    Location
    New York
    Posts
    138
    Vote Rating
    1
      0  

    Default

    Quote Originally Posted by mitchellsimoens View Post
    The menu is held at toolbar.layout.overflowHanlder.menu
    Thanks, Mitchell. Also, I found the "more" button, its held in toolbar.layout.overflowHandler.menuTrigger, in case anyone was wondering.

  4. #4
    Sencha Premium Member
    Join Date
    Jun 2009
    Location
    Italy
    Posts
    18
    Vote Rating
    0
      0  

    Default

    ...and this is a way to remove the button in the handler of the button itself (that lose the reference if in the overflow menu)

    PHP Code:
    handler: function () {
      
    toolbar[0].remove(this); //this give warning if button is in overflow menu
      
    menuItems toolbar[0].layout.overflowHandler.menuItems;
      for (var 
    0menuItems.lengthx++) {
        if(
    menuItems[x].overflowClone == this) {
          
    toolbar[0].remove(menuItems[x]); //this is the real button reference to remove
          
    break;
        };
      }

    I hope it can save someone some hour of code digging...

Posting Permissions

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