beforeColumnMove provides wrong target value when column is moved from right to left

Hi Team,

we are using beforeColumnMove to keep track of what columns are being moved where. This works fine if columns are moved from left to right. But when a column is moved from right to left, the target value is shown wrong. The target value is shown as increased by 1 than expected value.

For example, if i move column from right to left (from source:5 to target:8) then the target value given by beforeColumnMove is 9. it should be 8.

Is this expected?

thanks
Ashmi

I would say that moving columns from left to right returns a false index.

Here’s a demo Handsontable example - JSFiddle - Code Playground

If we move columns A and B we should get odd results, and they depend on where you place the handler - not from the result.

We should get that the index 0 turned to 1 and then 1 to 0, as we can see by the columns.

There’s also an odd situation when we use the handler but the columns stay the same.

Please let me know if I am missing something.

You are right Aleksandra. what is the fix for this or any workaround?

I am afraid that there’s no fix for what is returned by a callback. This lays deeply in the plugin’s logic. However, the moving feature is pretty popular when it comes to Handsontable abilities so I think that we will be able to fix it soon.

This issue was solved way back in v. 8.0.0.