Add new row in editable mode when clicking on custom button or icon
Hello All, I need to add new row editable mode on click the custom icon which was created by actions props like
actions={[
{
icon: () =>
IS there any possibity to do this?
I tried to achieve this by doing the following:
actions={[
{
icon: tableIcons.FileCopy,
tooltip: 'Copy',
onClick: (event, rowData) => {
tableRef.current.props.editable.onRowAdd(rowData)
},
},
]}
However, ran into error of Uncaught TypeError: Cannot read property 'editing' of undefined
Running into the same question -- need to use the standard mat-ui floating add icon. (The circle with the plus sign.) @MeghaBambra Did you figure this out?
So I got this working with the following:
actions={[
{
icon: tableIcons.FileCopy,
tooltip: 'Copy',
onClick: (event, rowData) => {
const newData = {...rowData, uuid: uuid() }
tableRef.current.props.editable.onRowAdd(newData)
},
},
]}
You cannot pass rowData as it was cause an error - guessing because its modifying existing data structure table is bound to. So i created a copy of it.
This however just simply copies an existing row and adds a new row without being in editable mode. I'm guessing you'll I've to dig through the props and see if that option is exposed.
anyupdates on this one?
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.