Material-ui: MenuItem onClick doesn't pass proper argument

Created on 29 May 2018  路  1Comment  路  Source: mui-org/material-ui

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.

  • [x] This is a v1.x issue (v0.x is no longer maintained).
  • [x] 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 |

question

Most helpful comment

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

>All comments

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sys13 picture sys13  路  3Comments

activatedgeek picture activatedgeek  路  3Comments

finaiized picture finaiized  路  3Comments

ghost picture ghost  路  3Comments

FranBran picture FranBran  路  3Comments