Treeview Item
A basic navigation link contained inside of a Treeview.
Note
This is a subclass of BaseMenuItem.
Constructor
Constructs a new TreeviewItem
.
new TreeviewItem({
menuItemElement,
menuLinkElement,
parentMenu,
isSubmenuItem,
childMenu,
toggle,
initialize,
});
The constructor will call BaseMenuItem's constructor with the provided options. It will also initialize the menu item if the initialize flag is set to true.
Parameters
Name | Type | Description | Default |
---|---|---|---|
options | object | The options for generating the menu item. | undefined |
options.menuItemElement | HTMLElement | The menu item in the DOM. | undefined |
options.menuLinkElement | HTMLElement | The menu item's link in the DOM. | undefined |
options.parentMenu | Treeview | The parent menu. | undefined |
options.isSubmenuItem | boolean | A flag to mark if the menu item is controlling a submenu. | false |
options.childMenu | Treeview , null | The child menu. | null |
options.toggle | TreeviewToggle , null | The controller for the child menu. | null |
options.initialize | boolean | A flag to initialize the menu item immediately upon creation. | true |
Initialize
Initialize the menu item.
TreeviewItem.initialize();
Initialize will call the BaseMenuItem's initialize method as well as set the menu item's role
to "none", the menu link's role
to "treeitem", and the menu link's tabIndex
to -1 in the DOM.
Properties
Properties are inherited from the BaseMenuItem class. There are no custom properties for the TreeviewItem class.
Getters and Setters
Getters and setters are inherited from the BaseMenuItem class. There are no custom getters and setters for the TreeviewItem class.
Methods
Methods are inherited from the BaseMenuItem class. The following methods are unique to or overwritten in the TreeviewItem class.
focus public
Focuses the menu item's link if the parent menu's shouldFocus value is true
.
TreeviewItem.focus();
This will call the BaseMenuItem's focus method as well as set the menu link's tabIndex
to 0 if the parent menu is the root menu.
blur public
Blurs the menu item's link if the parent menu's shouldFocus value is true
.
TreeviewItem.blur();
This will call the BaseMenuItem's focus method as well as set the menu link's tabIndex
to -1 if the parent menu is the root menu.