ColReorder column-reorder event give bad mapping when moving more than one column away

ColReorder column-reorder event give bad mapping when moving more than one column away

polepagepolepage Posts: 3Questions: 1Answers: 0

I have 3 columns in my table, and I listen to the column-reorder event.

If I move column 0 to the second position (.move(0, 1)) I get from=0, to=1 and mapping = [1, 0, 2] which is fine. This is also fine as long as I move the column only one space away.

If I move column 0 to the third position (.move(0, 2)) however I get from=0, to=2 and mapping = [2, 0, 1] which does not make sense at all. It should be [1, 2, 0]. The issue also occurs if y move 2 to 0 so any "2-spaces move".

Am I missing something?

Answers

  • polepagepolepage Posts: 3Questions: 1Answers: 0

    Using ColReorder 1.5.0. It is mostly an issue because the column visibility from Buttons 1.5.6 use that mapping to move around the buttons.

  • polepagepolepage Posts: 3Questions: 1Answers: 0

    Ok I guess I misinterpreted what the mapping mean. However, the Buttons plugin does seem to interpret that wrong too in how columnsToggle buttons are reordered.

  • colincolin Posts: 15,146Questions: 1Answers: 2,586

    Hi @polepage ,

    We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

This discussion has been closed.