Remove Row have to wipe the data instead of removing the row completely

Tags: #<Tag:0x00007f8b25a822f0>

Hi,

Is it possible to wipe the data of the row instead of removing the row completely using the “Remove row” context menu, if yes, please provide me an example for that.

Thanks,
Bala

Hi @ebalasubramanian24

you can use the setDataAtCell method to pass an empty string to all the cells in the row.

Here https://jsfiddle.net/handsoncode/f6aLvsx1/ is an example with a button that erases content from all the cells in a selected row.

Thank you… Is there a way to prevent the remove row event triggered from the context menu?

You can compose a custom set of options for the context menu if you do not need this option.

For example contextMenu: ['row_above', 'row_below'] will only allow to add a row below and above selected row.

What you would like to have in your context menu?

Actually my requirement is Remove row have to be there, and for certain range of rows the remove row have to just wipe the data and after that range it has to delete the row from the screen itself, give me a good suggestion to achieve this.

OK, so you need to create a custom context menu option. Here is an example https://jsfiddle.net/handsoncode/8L2uwg1f/

I have used the row < 5 condition. Every row with a lower index is erased and 5 or higher are deleted.

Thank you @aleksandra_budnik, it works charm!!!

you’re welcome :slight_smile:
we can close the topic