komarovalexander / ka-table

Lightweight MIT React Table component with Sorting, Filtering, Grouping, Virtualization, Editing and many more
http://ka-table.com
MIT License
788 stars 58 forks source link

Getting wrong target row key value on reordering #346

Closed ShubhamSinghNW18 closed 1 year ago

ShubhamSinghNW18 commented 1 year ago

Hi @komarovalexander I am getting wrong targetRowKeyValue while using drag & drop row data feature

komarovalexander commented 1 year ago

Hi @ShubhamSinghNW18 can you share a stackblitz example of that issue? Thanks!

ShubhamSinghNW18 commented 1 year ago

Hi @komarovalexander Please check this url https://stackblitz.com/edit/table-row-reordering-ts-2j7isl?file=Demo.tsx

On line number 34 I have added 1 console log which shows the targetRowKeyValue

when you reorder the column 1 row 0 to position 1 it shows the targetRowKeyValue as 1 which is correct but when you reorder that same row i.e column 1 row 0 to position 0 it again shows targetRowKeyValue as 1 ideally it should show 0 because we are reordering that row to position 0

ShubhamSinghNW18 commented 1 year ago

Hi @komarovalexander Do you have any update on this issue?

komarovalexander commented 1 year ago

Hi @ShubhamSinghNW18 it is actually works as expected, as it is targetRowKeyValue (not targetRowIndex), so to move one row from one position to another you have to specify the key of the row to which position you want to move it