From 39636be7b018b9121696ce7bdc462ab2c3c8185d Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Fri, 11 Jan 2013 17:11:28 +0100 Subject: o Creating bin/web for running the web application. --- src/main/webapp/apps/core/PagingTableService.js | 72 ------------------------- 1 file changed, 72 deletions(-) delete mode 100755 src/main/webapp/apps/core/PagingTableService.js (limited to 'src/main/webapp/apps/core/PagingTableService.js') diff --git a/src/main/webapp/apps/core/PagingTableService.js b/src/main/webapp/apps/core/PagingTableService.js deleted file mode 100755 index af593df..0000000 --- a/src/main/webapp/apps/core/PagingTableService.js +++ /dev/null @@ -1,72 +0,0 @@ -function PagingTableService() { - var create = function ($scope, fetchCallback, options) { - options = options || {}; - var watcher = options.watcher || function(){}; - var self = { - rows: [], - startIndex: options.startIndex || 0, - count: options.count || 10 - }; - - var update = function(){ - fetchCallback(self.startIndex, self.count, function(data) { - self.rows = data.rows; - watcher(); - }); - }; - - self.first = function () { - self.startIndex = 0; - update(); - }; - - self.next = function () { - self.startIndex += self.count; - update(); - }; - - self.prev = function () { - if (self.startIndex == 0) { - return; - } - self.startIndex -= self.count; - update(); - }; - - // Do an initial fetch - update(); - - return self; - }; - - var defaultCallback = function(Resource, args) { - args = args || {}; - return function(startIndex, count, cb) { - if(startIndex) { - args.startIndex = startIndex; - } - if(count) { - args.count = count; - } - console.log("fetching", args); - Resource.query(args, function(data, headers) { - var totalResults = headers("total-results"); - console.log("totalResults", totalResults); - console.log("got data", data); - cb({ - totalResults: totalResults, - rows: data - }); - }); - }; - }; - - return { - create: create, - defaultCallback: defaultCallback - } -} - -angular. - module('pagingTableService', ['ngResource']). - factory('PagingTableService', PagingTableService); -- cgit v1.2.3