Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Menu] MenuItem onClick doesn't pass proper argument #11625

Closed
2 tasks done
RudmanMario opened this issue May 29, 2018 · 4 comments
Closed
2 tasks done

[Menu] MenuItem onClick doesn't pass proper argument #11625

RudmanMario opened this issue May 29, 2018 · 4 comments
Labels
component: menu This is the name of the generic UI component, not the React module! support: question Community support but can be turned into an improvement

Comments

@RudmanMario
Copy link

In my component I have a Table with mapped TableRow from some custom array of objects. In the last TableCell I want to have a icon button that onClick opens Menu with some MenuItem actions (edit and delete). The problem is that the onClick event of the MenuItem is always passing the last array element and not the one mapped to that particular TableRow.

  • This is a v1.x issue (v0.x is no longer maintained).
  • I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior

The onClick on the MenuItem should pass as an argument the appropriate array element when it is used inside map function.

Current Behavior

The onClick on the MenuItem is passing as an argument the last element in the array that is being mapped.

Steps to Reproduce (for bugs)

Sandbox example:
https://codesandbox.io/s/0x8lnylqj0

Your Environment

Tech Version
Material-UI v1.0.0
React v16.3.2
browser Chrome
@oliviertassinari oliviertassinari added the support: question Community support but can be turned into an improvement label May 29, 2018
@oliviertassinari
Copy link
Member

oliviertassinari commented May 29, 2018

@RudmanMario You are opening two menus at the same time:
capture d ecran 2018-05-29 a 20 44 45

You need to differentiate which menu is open and which is not.

@DonnaTelloo
Copy link

Same problem, did you fix this?

@oliviertassinari oliviertassinari added the component: menu This is the name of the generic UI component, not the React module! label Jun 9, 2021
@oliviertassinari oliviertassinari changed the title MenuItem onClick doesn't pass proper argument [Menu] MenuItem onClick doesn't pass proper argument Jun 9, 2021
@oliviertassinari
Copy link
Member

@DonnaTelloo Please ask on StackOverflow, it's better suited for this kind of pain. It's generic to React.

@DonnaTelloo

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: menu This is the name of the generic UI component, not the React module! support: question Community support but can be turned into an improvement
Projects
None yet
Development

No branches or pull requests

3 participants