diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2013-01-11 17:11:28 +0100 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2013-01-11 17:11:28 +0100 |
commit | 39636be7b018b9121696ce7bdc462ab2c3c8185d (patch) | |
tree | 08e33b02dce0082db08584ad6e09be1f4653bf41 /src/main/webapp/apps/core/PagingTableService.js | |
parent | 4e9d5b5a447144c910c2698975157ee296e2eac8 (diff) | |
download | esper-testing-39636be7b018b9121696ce7bdc462ab2c3c8185d.tar.gz esper-testing-39636be7b018b9121696ce7bdc462ab2c3c8185d.tar.bz2 esper-testing-39636be7b018b9121696ce7bdc462ab2c3c8185d.tar.xz esper-testing-39636be7b018b9121696ce7bdc462ab2c3c8185d.zip |
o Creating bin/web for running the web application.
Diffstat (limited to 'src/main/webapp/apps/core/PagingTableService.js')
-rwxr-xr-x | src/main/webapp/apps/core/PagingTableService.js | 72 |
1 files changed, 0 insertions, 72 deletions
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); |