MenuButton

A menu button component, consist of a button and a drop down popup menu. xclass: 'menubutton'.

parents: Button

defined in: base.js

Class

Attributes

  • activeItem {Menu.Item} Current active menu item.
  • collapsed {Boolean} Whether drop menu is shown.
  • matchElWidth {} Whether drop down menu is same width with button.
  • menu {Menu} Drop down menu associated with this menubutton.

Methods


Class Detail

  • MenuButton ()
    A menu button component, consist of a button and a drop down popup menu. xclass: 'menubutton'.

Attributes Detail

  • activeItem {Menu.Item} Current active menu item.
  • collapsed {Boolean} Whether drop menu is shown.
  • matchElWidth Whether drop down menu is same width with button. Default: true.
  • menu {Menu} Drop down menu associated with this menubutton.

Methods Detail

  • addItem (item, index) view source
    Adds a new menu item at the end of the menu.
    Parameters
    •   item {Menu.Item} Menu item to add to the menu.
    •   index
  • bindMenu () view source
    Bind menu to current component. Protected, should only be overridden by subclasses.
  • decorateChildrenInternal (UI, el) view source
    Decorate child element to from a child component.
    Parameters
    •   UI {Function} Child component's constructor
    •   el {NodeList} Child component's root element.
  • getItemAt (index) view source
    Returns the child menu item of drop down menu at the given index, or null if the index is out of bounds.
    Parameters
    •   index {Number} 0-based index.
  • handleBlur (e) view source
    Handles blur event. When it loses keyboard focus, close the drop dow menu.
    Parameters
    •   e {Event.Object} Blur event. Protected, should only be overridden by subclasses.
  • handleKeyEventInternal (e) view source
    Handle keydown/up event. If drop down menu is visible then handle event to menu. Returns true if the event was handled, falsy otherwise. Protected, should only be overridden by subclasses.
    Parameters
    Returns
    • {Boolean} True Whether the key event was handled.
  • handleMenuClick (e) view source
    Handle click on drop down menu. Fire click event on menubutton. Protected, should only be overridden by subclasses.
    Parameters
  • performActionInternal () view source
    Perform default action for menubutton. Toggle the drop down menu to show or hide. Protected, should only be overridden by subclasses.
  • removeItem (c, destroy) view source
    Remove a existing menu item from drop down menu.
    Parameters
    •   c {Menu.Item} Existing menu item.
    • [ destroy ] {Boolean} Whether destroy removed menu item.
  • removeItems (destroy) view source
    Remove all menu items from drop down menu.
    Parameters
    • [ destroy ] {Boolean} Whether destroy removed menu items.
blog comments powered by Disqus
Top