gregnb / gregnb/mui-datatables

Deleting rows from customToolbarSelect

Open
#544 10 comments 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
JavaScript
Stars
2.7k
Forks
906
PR merge metrics
No merged PRs in 30d

Description

In discussing the original implementation of the `customToolbarSelect` property (#49), @gregnb gives the example of using `customToolbarSelect` and adding a `DeleteIcon` to the custom toolbar to continue supporting deleting rows. The example goes on to show a `handleClick`, but not actually the deleting of the rows.

Beyond either manually modifying the data as a property (which [would reinitialize the table](https://github.com/gregnb/mui-datatables/blob/8b3a4a6a42dfa6ac2c799fd0935206d37bedf93f/src/MUIDataTable.js#L177) removing current filters/page number, or creating a ref and updating the state through that (using setTableData as is done in the [`selectRowsDelete`](https://github.com/gregnb/mui-datatables/blob/8b3a4a6a42dfa6ac2c799fd0935206d37bedf93f/src/MUIDataTable.js#L781) method now and manually triggering the `onRowsDelete`) I can't delete rows when `customToolbarSelect` is enabled

## Expected Behavior

I should be able to delete rows when `customToolbarSelect` is selected

## Current Behavior

I can't delete rows when `customToolbarSelect` is selected

## Steps to Reproduce (for bugs)
1. Enable `customToolbarSelect`
2. Try to delete rows

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the customToolbarSelect example from issue #49 and inspect src/MUIDataTable.js, especially the setTableData call near line 177 and selectRowsDelete near line 781. Compare how selected rows and onRowsDelete are handled, then verify that deletion works with customToolbarSelect without losing current filters or page state.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.