[GH-DEV#2890] Batch execution of undo when row move

Hello,

When moving multiple rows with ManualRowMove plugin, the row move action is executed only once. However, when I try to undo the action, the row move action is executed multiple times. Is there any way to batch the row move actions on undo?

  1. In below example, click the ‘move’ button to move multiple rows, beforeRowMove action occurs only once
  2. Try to undo (ctrl + z) and the beforeRowMove action occurs multiple times

Hi @hjeong1200

You are right. Thank you for sharing the demo and doing the investigation.

It does not seem convenient to use the hook when the user undoes the action. I believe that it happens, as under the hood, we are reading the rows one by one while checking the correct row index. However, from a developer’s point of view, in your case, you get hundreds of calls from the hook for an action that visually seems to be a one-click operation.

I will report this issue internally and talk with the team at the next planning meeting. Currently, the only workaround that I see is to add another check within the beforeUndo hook, which runs before the beforeRowMove hook. The beforeUndo hook allows you to create a condition based on the type of action that is undone. In this case, that will be actionType: ‘row_move’. Following that outcome, you can create a condition within the beforeRowMove to skip the execution of the additional logic if undoRedo raises a flag that we’re dealing with the actionType: ‘row_move’.

Nevertheless, I will keep you updated about the team’s feedback.