From e1890d319985cbf2285dcd98f4b6e6916ebbbe65 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Tue, 1 Apr 2014 16:28:52 -0400 Subject: [PATCH] web staff : grid cont. Signed-off-by: Bill Erickson --- Open-ILS/src/templates/staff/parts/t_autogrid2.tt2 | 119 ++++++++++++++++++++- Open-ILS/src/templates/staff/test/t_autogrid.tt2 | 2 - Open-ILS/web/js/ui/default/staff/services/grid2.js | 61 ++++++++++- 3 files changed, 177 insertions(+), 5 deletions(-) diff --git a/Open-ILS/src/templates/staff/parts/t_autogrid2.tt2 b/Open-ILS/src/templates/staff/parts/t_autogrid2.tt2 index 1ce032fd2a..36ccfc5d79 100644 --- a/Open-ILS/src/templates/staff/parts/t_autogrid2.tt2 +++ b/Open-ILS/src/templates/staff/parts/t_autogrid2.tt2 @@ -1,7 +1,121 @@ + + +
+ +
+
{{grid.mainLabel}}
+
+ + +
+ + + + + + + + + + + +
+ + +
+ +
+ + +
+ + + +
+
+
+
@@ -21,18 +135,19 @@
-
+
[% l('No Items To Display') %]
- {{$index + grid.offset}} + {{$index + grid.offset + 1}}
-

AutoGrid w/ Auto Fields

- 0) { + grid.offset = (page - 1) * grid.limit; + grid.collect(); + } + } + + grid.onFirstPage = function() { + return grid.offset == 0; + } + + grid.hasNextPage = function() { + // we have less data than requested, there must + // not be any more pages + if (grid.count() < grid.limit) return false; + + // if the total count is not known, assume that a full + // page of data implies more pages are available. + if (grid.totalCount == -1) return true; + + // we have a full page of data, but is there more? + return grid.totalCount > (grid.offset + grid.count()); + } + + grid.incrementPage = function() { + grid.offset += grid.limit; + grid.collect(); + } + + grid.decrementPage = function() { + if (grid.offset < grid.limit) { + grid.offset = 0; + } else { + grid.offset -= grid.limit; + } + grid.collect(); + } + + // number of items loaded for the current page of results grid.count = function() { return grid.items.length; } + // returns the unique identifier value for the provided item grid.indexValue = function(item) { if (angular.isObject(item)) { if (item !== null) { @@ -171,6 +219,7 @@ angular.module('egGridMod', return -1; } + // handles click, control-click, and shift-click grid.handleRowClick = function($event, item) { var index = grid.indexValue(item); @@ -253,6 +302,16 @@ angular.module('egGridMod', grid.collect(); } + grid.toggleConfDisplay = function() { + if (grid.showGridConf) { + grid.showGridConf = false; + grid.compileSort(); + grid.collect(); + } else { + grid.showGridConf = true; + } + } + // asks the dataProvider for a page of data grid.collect = function() { grid.items = []; @@ -304,7 +363,7 @@ angular.module('egGridMod', cols.showAllColumns = function() { angular.forEach(cols.columns, function(column) { - col.visible[column.name] = true; + cols.visible[column.name] = true; }); } -- 2.11.0