Menu In Perspective

If I have a menu that has three list items, and a user selects the third item, is there a way to get the text of the item that he selected? I am looking for a way to figure out what item a user selects.

It depends on your version, in 8.0.5 they added an event handler for the Menu Tree named “onItemClicked”
The event object includes arguments for enabled, label, path, and target.

Fired whenever an item is clicked on this menu.

	self: A reference to the component that is invoking this function.
	event: An object with the following attributes:
		enabled (bool): Whether the item interacted with is enabled.
		label (str): Text to display for this option.
		path (list): A list containing the item indexes leading to the item
		             that was clicked.
		target (str): A url (external) or a mounted path to a page.
item = event.label

Before 8.0.5 I am not sure this was there, I cant see it on my 8.0.4 Stable gateway.



Thank you!

1 Like