How to handle menu item click?

Hello.

I am triying to handle the items click event of the <MenuComponent/> as says a documentation article (link below) but I dont figure out how to identify the menu item that triggers the event.

I want to know when user clicks a spesific button (log out, profile, etc...) to call the button's related function

Is there a way to do something like this?:

this.menuItems = [
            {
                items: [
                    { text: 'Conferences', onClick:()=>{myFunction} }
                ],
                text: 'Events'
},

The documentation article:  https://ej2.syncfusion.com/react/documentation/menu/how-to/customize-menu-using-events/

Thanks.

1 Reply 1 reply marked as answer

SD Saranya Dhayalan Syncfusion Team June 29, 2020 07:59 AM UTC

Hi Daniel, 
 
Thank you for contacting Syncfusion support 
 
We have checked your reported query, you can achieve this by using menu select event. Please find the below code snippet: 
 
  menuSelect(args){ 
          if(args.item.text == "File"){ 
            alert("File Menu selected"); 
          } 
        } 
For your convenience we have prepared a sample. Please find the below sample link 
 
 
Please check the above sample and get back to us if you need further assistance on this. 
 
Regards, 
Saranya D 


Marked as answer
Loader.
Up arrow icon