LP#1730752 Grid column move-to-last fix
authorBill Erickson <berickxx@gmail.com>
Tue, 6 Feb 2018 19:35:30 +0000 (14:35 -0500)
committerBill Erickson <berickxx@gmail.com>
Fri, 9 Feb 2018 16:55:44 +0000 (11:55 -0500)
Grid column manager "move to last visible" now moves the column
correctly to the last visible slot instead of one slot after the last
visible slot.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Remington Steed <rjs7@calvin.edu>
Open-ILS/web/js/ui/default/staff/services/grid.js

index 3f7a9df..6b70e4b 100644 (file)
@@ -781,7 +781,14 @@ angular.module('egGridMod',
                             if (column.visible) lastVisible = idx;
                         }
                     );
-                    targetIdx = lastVisible + 1;
+
+                    // When moving a column (down) causes one or more
+                    // visible columns to shuffle forward, our column
+                    // moves into the slot of the last visible column.
+                    // Otherwise, put it into the slot directly following 
+                    // the last visible column.
+                    targetIdx = 
+                        srcIdx < lastVisible ? lastVisible : lastVisible + 1;
                 }
 
                 // Splice column out of old position, insert at new position.