Can some one please help me to get the Label name along with value attribute the Button menu with custom onselect handler... plz also note that I also tried event.detail.value gives me only value not the label.
HI Mayank, Your ask seems similar to https://salesforce.stackexchange.com/questions/278687/how-i-can-get-the-label-of-the-selected-value-in-combobox-lightning-web-compon/278691 which is in the context of combobox
"You do not have direct way of getting label (as you get only selected value in event.detail). You need to depend on all options (simply get it from event.target) and filter based on selected value. You can use below:
Thanks Swetha & Veer for your quick response which I really appreciate. But in both the ways my problem is not getting solved. As I need the id of the clicked record as value while label is fine here. I have attatched the snapshot of the requirement. Please help me. I am new in LWC and so difficult to related the things. Thanks for all your efforts till now.!! It is very urget...
Hi Veer, You got my point now. code in the above screesho is working fine and i'm able to get the value as ID as well but not the lebel. However, by your approach I am able to get value but in string type and label too. Is it possible i could get value as ID. Hope you understand.
Your ask seems similar to https://salesforce.stackexchange.com/questions/278687/how-i-can-get-the-label-of-the-selected-value-in-combobox-lightning-web-compon/278691 which is in the context of combobox
"You do not have direct way of getting label (as you get only selected value in event.detail). You need to depend on all options (simply get it from event.target) and filter based on selected value. You can use below:
Hope this helps you. Please mark this answer as best so that others facing the same issue will find this information useful. Thank you
you should try following Code
If it's help you, Please Best Mark so that it help others
Thank You
Hello mayank,
I saw your snapshot, I think you want ID when you click on approve OR Reject Button-Menu.
But your data-key's row-id id In small Letter And your lightning-menu-item's value's {row.Id} Id is Capital
data-key={row.id} AND value={row.Id} Both are Different,Once you should check your code and try again.
You got my point now. code in the above screesho is working fine and i'm able to get the value as ID as well but not the lebel. However, by your approach I am able to get value but in string type and label too. Is it possible i could get value as ID. Hope you understand.
Hi Mayank,
You should aply this following Method in your apex Class,If you are using apex in your requirment.
this Method is convert string into Id
If This time your requirment is not complete then plz show your complete code Like HTML,JS And Apex.
I will try to Fix Your Issue.
Thank You Mayank