Move rows programatically

Tags: #<Tag:0x00007f8b1d4b73a0>

Hi all,

I want to move some rows when a button is clicked. Lets say rows 2,3,4 to finalIndex ‘10’

I’m doing the below but it isn’t updating the table (with or without the render) - any idea what I’m doing wrong? I was hoping the move plugin would speed me along and mean i don’t have to mess around with deleting/inserting rows

   const movePlugin = instance.getPlugin('manualRowMove')
   console.log(`Moving ${rows} to ${finalIndex}`)
   movePlugin.moveRows(rows, finalIndex)
   instance.render()

Fiddle: https://jsfiddle.net/21m80jqo/

Hi @HC289

With the changes in v8 (Migration Guide) dragging or moving rows to the last index in the table are canceled.

Some of actions to be performed by moveRows function aren’t possible, i.e. we can’t move more than one element to the last position. In this case, the move will be cancelled.

However, you can add a helper row and remove it to keep this functionality working in v8+. Here’s a demo https://jsfiddle.net/712xqd8t/2/