From 2b09a15231ad95c7adf51f0cb311dc22d2199442 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Mon, 28 Apr 2014 18:05:44 -0400 Subject: [PATCH] minor repairs; grid required cols and onitemretrieve Signed-off-by: Bill Erickson --- .../src/templates/staff/circ/patron/t_items_out.tt2 | 4 ++-- Open-ILS/web/js/ui/default/staff/services/grid.js | 19 ++++++++++++++++--- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/Open-ILS/src/templates/staff/circ/patron/t_items_out.tt2 b/Open-ILS/src/templates/staff/circ/patron/t_items_out.tt2 index 16d5785520..4b8e1b9a29 100644 --- a/Open-ILS/src/templates/staff/circ/patron/t_items_out.tt2 +++ b/Open-ILS/src/templates/staff/circ/patron/t_items_out.tt2 @@ -7,8 +7,8 @@ main-label="[% l('Items Checked Out') %]" items-provider="gridDataProvider" persist-key="eg.staff.circ.patron.items_out"> - - + + diff --git a/Open-ILS/web/js/ui/default/staff/services/grid.js b/Open-ILS/web/js/ui/default/staff/services/grid.js index ae4e340219..76b74dbb7e 100644 --- a/Open-ILS/web/js/ui/default/staff/services/grid.js +++ b/Open-ILS/web/js/ui/default/staff/services/grid.js @@ -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; } ); -- 2.11.0