material-table icon indicating copy to clipboard operation
material-table copied to clipboard

How to get actual row index adding/editing?

Open fofederico opened this issue 6 years ago • 1 comments

Hello!

I want to know how to get the actual row index when i am adding/editing a line, is it possible?

I am overriding the EditField component like this, because i want to display a context menu per cell and do other things...

`

  components={{
    EditField: (props) => {
      return (
        <TextField
          type={props?.columnDef?.type}
          onChange={(e) => props.onChange(e.target.value)}
          onContextMenu={(e) => {
            e.preventDefault();
            //TODO: display menu options
          }}
          onFocus={(e) => {
            console.log("Focused column field", props?.columnDef?.field);
            //TODO: use this field id to do something in menu options
          }}
          value={props.value || ""}
        />
      );
    },
  }}/>

`

image

I would greatly appreciate the help.

Federico.

fofederico avatar Nov 20 '20 11:11 fofederico

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You can reopen it if it required.

stale[bot] avatar Feb 18 '21 12:02 stale[bot]