gregnb / gregnb/mui-datatables

How to propery remove rows data from state?

Open
#1,666 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
2.7k
Forks
906
PR merge metrics
No merged PRs in 30d

Description

I am using the DataTable with firebase and there is no problem removing the data from firebase. However, I face problem when deleting multiple rows from the state (data for the table) array on the client side. I have tried several solutions but none of them worked. I am using onRowsDelete function.
I have tried for example this: push all dataIndexes from onRowsDelete to one array then for each element in this array slice the state object. But this does not work correctly, because every time the function runs the indexes are not the same as before. I have also tried filter methods and several others, it all works fine when deleting one row but does not work as I want when deleting multiple rows. I have also tried setState as newTableData from the function arguments but that is not the way I want to do this and it doesn't work as I expected.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the DataTable component's onRowsDelete handler and reproduce deletion of multiple selected rows from the client-side table state. Compare the row indexes passed to the handler with the state update, and consider the work done when multiple rows are removed correctly without affecting other rows.

Written by the indexing model from the issue text.

Assessment

Tech stack
firebase, javascript, react
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.