ui:menuTriggerPress
Deprecated as of API version 47.0. Use lightning:buttonMenu instead.
::::::tabset{tabs='[ "Develop", "Specifications"]'}
:::::tab
This event is fired when you click on the ui:menuTriggerLink component. To set a handler for the ui:menuTriggerLink event, use the menuTriggerPress attribute on ui:menuTriggerLink.
The following example shows a menu with two list items. The handleTriggerPress client-side controller action handles the ui:menuTriggerPress event.
<aura:component>
<ui:menu>
<ui:menuTriggerLink
aura:id="trigger"
label="Contacts"
menuTriggerPress="{!c.handleTriggerPress}"
/>
<ui:menuList class="actionMenu" aura:id="actionMenu">
<ui:actionMenuItem aura:id="item1" label="All Contacts" click="{!c.doSomething}" />
<ui:actionMenuItem aura:id="item2" label="All Primary" click="{!c.doSomething}" />
</ui:menuList>
</ui:menu>
</aura:component>
This client-side controller retrieves the label of the trigger when it’s clicked.
({
handleTriggerPress: function (component, event, helper) {
var trigger = component.find("trigger");
// Get the label on the trigger
var triggerLabel = trigger.get("v.label");
},
});
If you're using this event with a component other than ui:menuTriggerLink, register the event first.
<aura:registerEvent
name="menuTriggerPress"
type="ui:menuTriggerPress"
description="The event fired when the trigger is clicked."
/>
:::::
:::::tab
:::::
::::::