When dragging and dropping columns changing their order, jqgrid will fire jqGridRemapColumns
giving you an array of the movement. Example [0,1,5,2,3,4]
the last element was moved to the third position. What I am trying to do is save these transformations between sessions so I can move the columns back to the order they were left with remapColumns
which takes an array of the transformations.
The issue is when remapColumns has been called with transformations, and then more transformations are applied on top. Since jqGridRemapColumns
doesn't return the array with the previous transformations only the new ones. So the saved array gets overridden and only the newest transformations are saved.
How would I combine two arrays like [0,1,5,2,3,4]
(move last element to the third) and [0,2,3,4,1,5]
(move the second element to the second last) to get [0,5,2,3,1,4]
?