Event column-reorder behavior issue.
Event column-reorder behavior issue.
An issue with column-reorder
event.
What I am trying to obtain, is to know if the original column order has been changed. To achieve this, I am using the column-reorder
event, and especially the details.mapping
parameter.
I was assuming, that if the column order is in the original order, the mapping is a sorted list starting from 0 till the number of columns - 1.
But this appears not to be. So maybe I am missing something.
Here the steps I have done:
Changed columns 2 and 3
details.from
shows 2 and details.to
shows 3 which is, in my opinion correct.
details.mapping
shows 0,1,3,2,4,5,6,7,8,9,10,11,12,13,14,15,16 and this also seems correct.
But then, if I change columns 3 and 2 (so the original situation is back)
details.from
shows 3 and details.to
shows 2 (correct), but
details.mapping
shows 0,1,3,2,4,5,6,7,8,9,10,11,12,13,14,15,16 which is not representing the actual situation.
My 2 questions are:
- how can I check if the original column order of a table has been changed?
- is the behavior of the
column-reorder
correct, in respect to the value ofdetails.mapping
?
This question has an accepted answers - jump to answer
Answers
Hi Tester2017,
you can use
colReorder.transpose()
to compare the current order with its initial positioning.Yep, that's correct. It's not comparing with the initial positions. it's comparing with the positions before and after the move that triggered the event.
Hope that helps!
Cheers,
Colin
@colin
Thanks!
This resolved my issue and it works like a charm. I have a button that will reorder the columns to their original state, but I will only enable this button if the original state has been changed.
colReorder.transpose()
is perfect for this job.