The examples for the editable component at https://material-table.com/#/docs/features/editable no longer work due to what looks like a change in the way oldData is passed to the callback function. Previously it would be a reference to the old row, but now it looks like a new tableData key has been added to the object, which makes it so data.indexOf(oldData) no longer returns the correct row. I don't know if this was intended or not, but either ways the documentation needs to be updated with the correct way to implement editable components.
I'm trying to use editable and editComponent but it isn't working.
Since which version editable does not work? I'm using "material-table": "^1.23.7"
This is now broken for me as well after performing a yarn upgrade which did the following:
- version "1.50.0"
- resolved "https://registry.yarnpkg.com/material-table/-/material-table-1.50.0.tgz#16afabae311f768382b5884d34a230984a687933"
- integrity sha512-N7JH/YkAUHHddqIP/t3vtRLtbK5zsnyzCvjdwaVO8KbtzKA9kYgjxpuNZ/waHwdL4Fa55rZgP7fYYbMioByi9g==
+ version "1.53.0"
+ resolved "https://registry.yarnpkg.com/material-table/-/material-table-1.53.0.tgz#d6e14a71ae57ad5096ec862aff926ecd1ed995fb"
+ integrity sha512-nsPXYABMb4MQEfz1SOlQi6vFJuzZPR4AMyE/EbP26/gkHL/jsa+Z5pBG3liiHbGUy7flONckpzqYWZ3wLf5iKw==
...
- filefy "0.1.9"
+ filefy "0.1.10"
Hey, I'm testing and it worked with a specific version of the material-table that is:
"@material-ui/core": "3.9.2",
"material-table": "1.29"
If you change the minor version to like "material-table": "^1.29" will not work.
And the parameter in this version is readonly: true instead editable, I think that is not well documented, i had to investigate to found this
Hey I just had this issue, and to fix it, rather than using data.indexOf(oldData), oldData now comes back with a tableData: {id:"insert number"}.
You can just use data[oldData.tableData.id] = newData; rather than trying to grab the index now.
Delete is broken as well. The fix is:
data.splice(data.indexOf(oldData), 1); --> data.splice(oldData.tableData.id, 1);
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.
Most helpful comment
Hey I just had this issue, and to fix it, rather than using data.indexOf(oldData), oldData now comes back with a
tableData: {id:"insert number"}.You can just use
data[oldData.tableData.id] = newData;rather than trying to grab the index now.