How can I delete multiple row order and unorder way in handsontable

Tags: #<Tag:0x00007efc6d276418> #<Tag:0x00007efc6d275c48>

How can I delete multiple row “order and unorder” selection of row in handsontable in one go by click the remove row in context menu?

Hi @saran123

Can you please specify what do you mean by order and unorder in this case?

How to delete a highlighted row in single click? order means select a row in order like 1,2,3 unorder means select a row in not contiguous like 2,4,6,7 like that


already this issue is created but there is no solution

@saran123

Thank you for the explanation. While we don’t have an example showing such solution I can give you some tips what can be used to achieve that. First, to get the ID’s of the selected rows you can use the afterSelectionEnd hook: https://handsontable.com/docs/javascript-data-grid/api/hooks/#afterselectionend That will allow you to recognise the selected rows ID. Then you can use the alter() method to remove the selected rows: https://handsontable.com/docs/javascript-data-grid/api/core/#alter

It’s up to your requirement if that should be handled by the external button or custom context menu option, which also can be created: https://handsontable.com/docs/javascript-data-grid/context-menu/#context-menu-with-a-fully-custom-configuration

You can start from this point and if you encounter the issues during the implementation, let us know and we’ll try to help.

Here afterSelectionEnd function call twice for “not contiguous” selection like 2,4 why? and also It give result like 1 , -1,0,2 like that which value I have to use?

and also it remove from the table once I select the row, I need to remove the row after select single or multiple row and click the “remove row” option in context menu

Then, In remove alter method hot.alter('remove_row', [[1, 3], [5, 2]]);, how I can give value here for example if I delete 2 , 5 row in an table means, how should I use my selected rows ID?

Kindly provide me a sample example for this.

@saran123

The afterSelectionEnd hook, it returns coordinates of where the selection started and ends consisting of rows and column ID’s. You can find the description of the parameters in the documentation that I sent you in my previous message.

It doesn’t wait for multiple selection, because I used the alter() method inside the afterSelectionEnd method. so how to handle this I want just store the selected row and remove all the row after I click the “remove row” in my context menu.

Kindly provide me sample example for this, because there is no example for multiple row delete. It will help for other who work on multiple row deletion

Thanks

@saran123

We are not able to prepare custom examples with the pre-sales support. If you already purchased the license, please send us you license ID at support@handsontable.com so we can check your current support plan.