[GH #1038] Row move event issue when using nestedRows

Tags: #<Tag:0x00007f8b1d712eb0> #<Tag:0x00007f8b1d712cf8>

Version: 14.2

When nestedRows is set to true:

  1. The event beforeRowMove is fired after afterRowMove.
  2. The parameter “movedRows” in beforeRowMove is changed to a boolean instead of an array.
  3. When the beforeRowMove callback function returns false, it does not cancel the action.

Demo: https://jsfiddle.net/3wLtfanj/3/

Since the manualRowMove does not work when nestedRows is true, indicating a limitation with nestedRows, I intend to use the beforeRowMove event to prevent the move and utilize the updateData() function to achieve manual row movement. Could you please assist me in verifying whether the above-mentioned issue is indeed an issue or if it’s due to oversight on my part? Thank you!

Hi @jimmy.yang

Thank you for contacting us. The issue with beforeRowMove firing before afterRowMove is known to us, and we have it reported internally. As for the output of the arguments it possibly is like that due to the fact that in general moving rows is not possible with nested rows data structure, which also is reported in our repository.

Can you please tell me why do you want to block this functionality this way? It is disabled by default.

1 Like

Thank you for the prompt response.

As mentioned in the initial post, I am seeking to achieve manual row movement within a nested row structure. If I can utilize the beforeRowMove function to retrieve the rows the user is moving, I can simply swap the corresponding elements in my source data array to accomplish my objective.

For instance:
sourceDataArray = [{‘title’:‘A’, ‘value’:‘1’}, {‘title’:‘B’, ‘value’:‘2’}]

When moving row_0 to row_1 , beforeRowMove would provide movedRows=[0] and finalIndex=1 . Therefore, I only need to rearrange my sourceDataArray to [{'title':'B', 'value':'2'}, {'title':'A', 'value':'1'}] and then utilize updateData to reflect the changes in the table. This effectively achieves the desired outcome.

Thus, I do not necessarily require the original moving action to occur; it serves as a trigger for data manipulation purposes only. I will return false to cancel the default movement behavior.

P.S. Regarding the parameter “movedRows” in beforeRowMove , it should be possible with nested rows. I have tried to modify the .min.js file to console.log the parameter. It logs the correct array value.

Hi @jimmy.yang

I understand. Thank you for the explanation. In this case it should be determined by our team how it should be handled internally and also take a closer look about the difference in arguments output of beforeRowMove hook when nested rows is enabled. I think it could be done within the issue with correct hooks order. I’ll discuss it with the team and update you once I have more information.

1 Like

Thank you for your explanation and consideration.
I appreciate your attention to detail and look forward to hearing updates from your team.