material-table icon indicating copy to clipboard operation
material-table copied to clipboard

Editable with custom button

Open AbdurRehman26 opened this issue 5 years ago • 5 comments

I have override the action buttons but I need to trigger bulk edit. Is there any way to add a custom button with bulk Edit functionality ?

image

AbdurRehman26 avatar Dec 20 '20 20:12 AbdurRehman26

Hello, Maybe you can get this to work by doing a combination of some things which are available on the website and what I can see in the source code.

First, look at the duplicate action example. The functionality provides a button to duplicate the current row and trigger the changeRowEditing function. It utilizes the tableRef to access the dataManager for material-table.

Second, it appears that within data-manager.js there is a function to set that bulk edit feature called changeBulkEditOpen. Judging from the duplicate action example, you would need to trigger a state update after setting this value in order for the bulk edit to appear.

bgbbmm avatar Feb 09 '21 17:02 bgbbmm

Also is it possible for you to post your code for your custom buttons/overridden action buttons? That's something I am interested in using.

bgbbmm avatar Feb 10 '21 19:02 bgbbmm

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.

stale[bot] avatar May 12 '21 11:05 stale[bot]

I'm also looking for same bulk edit with custom button, please anyone can help.

Thanks in advance

PATTANPARVIN avatar Jun 23 '21 05:06 PATTANPARVIN

In agreeing with @bgbbmm and the duplicate action example they referenced, assuming you've passed a ref to the tableRef property in the table itself and you have your ref's current object in a variable named materialTable like in the example, this is what worked for me:

 materialTable.setState({
     ...materialTable.dataManager.getRenderState(),
     bulkEditOpen: true
})

nkindrew avatar Mar 17 '22 17:03 nkindrew