Major Issue in cellEditable while editing table cell, please check!!!!
i am using material table in my code.I am using cell editable. But when i edit my table cell, its style become wierd. Please see the image. How to fix this.
Seems like its does not work well with too many rows.
can we change the styling...?? like remove cross button
and change check size?
Codesandbox code: https://codesandbox.io/s/material-demo-forked-h1f8d?file=/demo.js:1142-1513

Easiest fix would be this: { title: "Surname",field: "surname",cellStyle: { minWidth: 150 },initialEditValue: "initial edit value"},
@Samurus Is there anyway to remove those check and cross icon?? or change its size
please read documentation https://material-table.com/#/docs/features/component-overriding you can override EditField like this: components={{ EditField: (props) => ( <div style={{ backgroundColor: "#whatever" }}> maybe use input field here
@PriyankDeep @Samurus
Check ad Cross icons are implemented in EditCell component. This component is not listed in
https://material-table.com/#/docs/features/component-overriding
but it can be overrided like any others:
<MaterialTable<RowType>
components={{
EditCell(props) {
return 'EDIT-CELL-OVERRIDE';
}
}
{...otherProps}
</
You can use https://github.com/mbrn/material-table/blob/master/src/components/m-table-edit-cell.js as implementation example. This way you have full control over cell edition component
@Samurus @thefat32
I'm also trying to fix this issue and the EditCell component override only works if the cells you're editing are of the same type. If one of the cells uses a dropdown selection for example, like in my case, then that solution doesn't work, because it changes all cell edit types to a text field.
Also, setting cellStyle with to a minWidth of 150 or even 300 doesn't fix the issue that @PriyankDeep pointed out. I tried setting the individual columns width, as well as the cellStyle width and neither option fixed that specific issue.
EditCell component receives columnDef with all details about the column including the type so you can render properly (EditField component is the one that renders depending on type (selector, chexkbox, text, etc) Do you have different cell types in the same column? Please if you can share with me your column's definition code.
@Samurus @thefat32 @kristinhorton @mbrn When using cellEdiatable, we have to first click on the cell, then edit it, click on check or cross button. But is there any way in which we can just click on tab button and make an edit. ??
I dont want that check and cross button on cellEdit.... I want it to be like, i click on cell and make an edit like normal input field (for numbers).
@PriyankDeep take a look at EditCell and EditField
Explaining short
- EditCell receives
onCellEditFinishedcallback - EditField has onChange property
You can reimplement EditCell to call onCellEditFinished when you want. I don't think you can make it work as a normal input as new value needs to be informed to material-table using the callback onCellEditFinished, this call ends edit process. But you can implement finish edition with Enter key and cancel edition with Esc key instead of check and cross icons.
@thefat32 can you show in codesandbox??
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.