2.0 KiB
Menu
Widget Functionality: Used to create interactive menu components, supporting static menu items, nested submenus, and dynamically loading remote submenus. Clicking a menu item can trigger actions such as page navigation or opening a popup window.
Type: Container widget
Parent Widget: bricks.VBox
Initialization Parameters
| Parameter | Type | Description |
|---|---|---|
options.bgcolor |
String | Background color of the menu; default is "white" |
options.items |
Array | Array of menu items, where each item contains properties like label, url, icon, target, etc. (see create_menuitem and create_children methods for details) |
options.item_cheight |
Number | Height unit (cheight) for menu items, affecting layout of icons and text |
options.menuitem_css |
String | Custom CSS class name for styling menu items |
options.target |
String | Target container type after clicking a menu item, e.g., 'PopupWindow', 'Popup', or another widget ID |
options.popup_options |
Object | Configuration options for popup behavior, used to customize display settings of PopupWindow or Popup |
Note:
optionsare also passed to the parent classVBox, inheriting its general layout parameters.
Main Events
-
item_click
Trigger: When a user clicks a menu item
Callback Parameters:itemobject (contains fields such aslabel,url,icon,target)
Handling Logic: Determines the opening method based onitem.target(e.g., new window, popup, or replacing content in a specified widget), and loads the corresponding URL content viawidgetBuild. -
command
Trigger: Dispatched aftermenu_clickedfinishes handling navigation logic
Callback Parameters: Sameoptsobject as initem_click
Purpose: Notifies external systems to execute additional commands or perform state updates.
Event binding is set via
this.bind('item_click', ...)in the constructor and triggered byregen_menuitem_event.