Update source data with the manualRowMove plugin

Hi there,

I am using the manualRowMove plugin and come up with a question. Is there a way to sync sourceData with the current row order after they have been moved with the plugin? Right now it only has an effect on the visual side, internal order of the entities (source data) of the table remain the same after manually moving them.

I’ve managed to adress it using the afterRowMove hook, where i have some logic to determine new order of the entites and sort them based on the args from the afterRowMove hook and then updating the data. It works so far but causing the whole table (or part of it, i dont know) to rerender and sometimes rather costy on large data sets.

Am i missing something and there is a more performant way?

Hi @hangor1939

Moving is working only on the visual indexes. The source data is a representation of physical indexes in the table. So, if you are reorganizing the data via afterRowMove that is correct.

@aleksandra_budnik Thank you for the quick response. So, there is no special internal method in the table to handle this case and i should rely only on my custom logic in afterRowMove?

Well you can also track the sequence of rows within the RowIndexMapper to make sure.

You refer to it on the instance level like https://stackblitz.com/edit/vitejs-vite-jx5dqs?file=main.js,style.css&terminal=dev

Thank you, i will take a look at RowIndexMapper, didn’t know about that feature.