Material-table: Add, update and delete methods in examples, not working

Created on 4 Dec 2019  路  7Comments  路  Source: mbrn/material-table

HI. I understand this issue has already been reported and relates to version update. Has it been fixed? If not, are there any workarounds or new methods to CRUD rows? Many thanks.

wontfix

Most helpful comment

I just opened an issue about it #1417

In the examples, change const data = this.state.data; to const data = Array.from(this.state.data); that will do the trick.

Guy

All 7 comments

I just opened an issue about it #1417

In the examples, change const data = this.state.data; to const data = Array.from(this.state.data); that will do the trick.

Guy

Worked like a charm. Thanks, Guy!

wow awesome, thankyou @guyla is worked like charm.

@guyla can you explain what happend ? why we can't use
const data = this.state.data;

My opinion we must update documentation at here because example not work well when update
https://material-table.com/#/docs/features/editable

Thanks

this occurs because of the indexOf isn't return the index as expected
a better solution is to use oldData.tableData.id to get the index of the row

instead, const index = data.indexOf(oldData) try const index = oldData.tableData.id

the docs are being updated

Examples provided are incorrect

I just opened an issue about it #1417

In the examples, change const data = this.state.data; to const data = Array.from(this.state.data); that will do the trick.

Guy

great

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

VipinJoshi picture VipinJoshi  路  3Comments

timrchavez picture timrchavez  路  3Comments

behrouz-s picture behrouz-s  路  3Comments

KKrisu picture KKrisu  路  3Comments

terapepo picture terapepo  路  3Comments