LP#1402797 Sort by class, and keep columns from one class together
authorMike Rylander <mrylander@gmail.com>
Tue, 11 Nov 2014 18:25:25 +0000 (13:25 -0500)
committerBill Erickson <berickxx@gmail.com>
Thu, 12 Feb 2015 16:58:27 +0000 (11:58 -0500)
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Kathy Lussier <klussier@masslnc.org>
Open-ILS/src/templates/staff/share/t_autogrid.tt2
Open-ILS/web/js/ui/default/staff/services/grid.js

index 12299c5..36cb85f 100644 (file)
         </a></li>
         <li role="presentation" class="divider"></li>
         <li ng-repeat="col in columns">
-          <a href ng-click="toggleColumnVisibility(col)">
+          <a href title="{{col.idlclass}}" ng-click="toggleColumnVisibility(col)">
               <span ng-if="col.visible" 
                 class="label label-success">&#x2713;</span>
               <span ng-if="!col.visible" 
index 772f3c6..9598dc4 100644 (file)
@@ -1050,6 +1050,15 @@ angular.module('egGridMod',
                     function(a, b) {
                         if (a.explicit) return -1;
                         if (b.explicit) return 1;
+                        if (a.idlclass && b.idlclass) {
+                            return a.idlclass < b.idlclass ? -1 : 1;
+                            return a.idlclass > b.idlclass ? 1 : -1;
+                        }
+                        if (a.path && b.path) {
+                            return a.path < b.path ? -1 : 1;
+                            return a.path > b.path ? 1 : -1;
+                        }
+
                         return a.label < b.label ? -1 : 1;
                     }
                 );
@@ -1144,19 +1153,10 @@ angular.module('egGridMod',
             
             if (!column.label) {
                 column.label = idl_info.idl_field.label || column.name;
-                /*
-                // append class label to column label to better differentiate
-                // columns in the selector.
-                // Disabled for now, since it results in columns w/ really
-                // long names, making the grid unappealing when any of
-                // these colmns are selected.
-                // TODO: consider nesting the colum picker by class?
-                if (fromExpand) {
-                    var label = 
-                        idl_info.idl_class.label || idl_info.idl_class.name;
-                    column.label = label + '::' + column.label;
-                }
-                */
+            }
+
+            if (fromExpand && idl_info.idl_class) {
+                column.idlclass = idl_info.idl_class.label || idl_info.idl_class.name;
             }
         },