minor repairs; grid required cols and onitemretrieve
authorBill Erickson <berick@esilibrary.com>
Mon, 28 Apr 2014 22:05:44 +0000 (18:05 -0400)
committerBill Erickson <berick@esilibrary.com>
Mon, 28 Apr 2014 22:05:44 +0000 (18:05 -0400)
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/src/templates/staff/circ/patron/t_items_out.tt2
Open-ILS/web/js/ui/default/staff/services/grid.js

index 16d5785..4b8e1b9 100644 (file)
@@ -7,8 +7,8 @@
   main-label="[% l('Items Checked Out') %]"
   items-provider="gridDataProvider"
   persist-key="eg.staff.circ.patron.items_out">
-  <eg-grid-field label="[% ('Circ ID') %]" path='id' visible></eg-grid-field>
-  <eg-grid-field label="[% ('Barcode') %]" path='target_copy.barcode' visible></eg-grid-field>
+  <eg-grid-field label="[% l('Circ ID') %]" path='id' visible></eg-grid-field>
+  <eg-grid-field label="[% l('Barcode') %]" path='target_copy.barcode' visible></eg-grid-field>
   <eg-grid-field label="[% l('Due Date') %]" path='due_date' visible></eg-grid-field>
   <eg-grid-field label="[% l('Checkout / Renewal Library') %]" path='circ_lib.shortname' visible></eg-grid-field>
   <eg-grid-field label="[% l('Renewals Remaining') %]" path='renewal_remaining' visible></eg-grid-field>
index ae4e340..76b74db 100644 (file)
@@ -43,9 +43,14 @@ angular.module('egGridMod',
             // optional primary grid label
             mainLabel : '@',
 
-            // if true, use the IDL class label as the mainLael
+            // if true, use the IDL class label as the mainLabel
             autoLabel : '=', 
 
+            // called on each item retrieved in collect() with the item
+            // as the argument.  Useful for modiying objects before they
+            // are absorbed by the grid.
+            onItemRetrieved : '=', 
+
             // optional context menu label
             menuLabel : '@'
         },
@@ -81,6 +86,7 @@ angular.module('egGridMod',
                 grid.showGridConf = false;
                 grid.dataProvider = $scope.itemsProvider;
                 grid.menuLabel = $scope.menuLabel;
+                grid.onItemRetrieved = $scope.onItemRetrieved;
 
                 grid.menuItems = [];
                 grid.addMenuItem = function(item) {
@@ -515,7 +521,11 @@ angular.module('egGridMod',
                 grid.selected = {};
                 grid.dataProvider.get(grid.offset, grid.limit)
                 .then(null, null, function(item) {
-                    if (item) grid.items.push(item)
+                    if (item) {
+                        if (grid.onItemRetrieved)
+                            grid.onItemRetrieved(item);
+                        grid.items.push(item)
+                    }
                 });
             }
 
@@ -552,6 +562,7 @@ angular.module('egGridMod',
                     'nonsortable',
                     'multisortable',
                     'nonmultisortable',
+                    'required' // if set, always fetch data for this column
                 ],
                 function(field) {
                     if (angular.isDefined(attrs[field]))
@@ -666,6 +677,7 @@ angular.module('egGridMod',
                 path  : colSpec.path,
                 flex  : Number(colSpec.flex) || 2,
                 sort  : Number(colSpec.sort) || 0,
+                required : colSpec.required,
                 visible  : colSpec.visible,
                 hidden   : colSpec.hidden,
                 datatype : colSpec.datatype,
@@ -882,7 +894,8 @@ angular.module('egGridMod',
                     var queryFields = {}
                     angular.forEach(provider.columnsProvider.columns, 
                         function(col) {
-                            if (provider.columnsProvider.visible[col.name]) 
+                            if (col.required ||
+                                    provider.columnsProvider.visible[col.name]) 
                                 queryFields[col.name] = col.path;
                         }
                     );