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

When the user presses the enter key while editing a row, it confirms and saves the changes. How can I prevent this?

Open tran-simon opened this issue 6 years ago • 5 comments

You can see this behavior in these demos: https://material-table.com/#/docs/features/editable

When you press enter, it saves the whole row.

I can I make it so that we can press enter without exiting edit mode?

thanks

tran-simon avatar Sep 22 '20 19:09 tran-simon

I don't think there's a setting to toggle enter at this time, but there are workarounds to disable that behavior. Maybe one of them would fit your need. See comments in https://github.com/mbrn/material-table/pull/2008

gxtaillon avatar Sep 22 '20 21:09 gxtaillon

I would like to be able to able to turn off or override the onEnter behavior for just a single column.

Edit: @gxtaillon suggests a possible column-specific modification to his workaround, but warns it might not be stable through version changes: https://github.com/mbrn/material-table/pull/2008#issuecomment-722690200

imnasnainaec avatar Nov 02 '20 20:11 imnasnainaec

Related: #2360

Edit: I was able to use stopPropagation() in my case, similar to https://github.com/mbrn/material-table/issues/2360#issuecomment-696271090

imnasnainaec avatar Nov 06 '20 20:11 imnasnainaec

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 04 '21 22:02 stale[bot]

you can use editComponent and handle by Key Event

phuoctrung-ppt avatar Oct 22 '21 02:10 phuoctrung-ppt