From e10cbbdd46418ab4149672b48c6ba806e66586c8 Mon Sep 17 00:00:00 2001 From: baron_l Date: Mon, 18 Mar 2019 16:32:30 +0100 Subject: [PATCH] fix(app): paginatedItemLimit now retrieved for datables extending GenericDatatableController --- .../components/datatables/genericDatatableController.js | 7 ++++--- app/portainer/services/localStorage.js | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/portainer/components/datatables/genericDatatableController.js b/app/portainer/components/datatables/genericDatatableController.js index 4f7ef4994..fe32e035f 100644 --- a/app/portainer/components/datatables/genericDatatableController.js +++ b/app/portainer/components/datatables/genericDatatableController.js @@ -1,11 +1,11 @@ angular.module('portainer.app') -.controller('GenericDatatableController', ['PaginationService', 'DatatableService', -function (PaginationService, DatatableService) { +.controller('GenericDatatableController', ['PaginationService', 'DatatableService', 'PAGINATION_MAX_ITEMS', +function (PaginationService, DatatableService, PAGINATION_MAX_ITEMS) { this.state = { selectAll: false, orderBy: this.orderBy, - paginatedItemLimit: PaginationService.getPaginationLimit(this.tableKey), + paginatedItemLimit: PAGINATION_MAX_ITEMS, displayTextFilter: false, selectedItemCount: 0, selectedItems: [] @@ -65,5 +65,6 @@ function (PaginationService, DatatableService) { function setDefaults(ctrl) { ctrl.showTextFilter = ctrl.showTextFilter ? ctrl.showTextFilter : false; ctrl.state.reverseOrder = ctrl.reverseOrder ? ctrl.reverseOrder : false; + ctrl.state.paginatedItemLimit = PaginationService.getPaginationLimit(ctrl.tableKey); } }]); diff --git a/app/portainer/services/localStorage.js b/app/portainer/services/localStorage.js index bc63fec00..98d817878 100644 --- a/app/portainer/services/localStorage.js +++ b/app/portainer/services/localStorage.js @@ -54,10 +54,10 @@ angular.module('portainer.app') localStorageService.remove('JWT'); }, storePaginationLimit: function(key, count) { - localStorageService.cookie.set('pagination_' + key, count); + localStorageService.set('datatable_pagination_' + key, count); }, getPaginationLimit: function(key) { - return localStorageService.cookie.get('pagination_' + key); + return localStorageService.get('datatable_pagination_' + key); }, getDataTableOrder: function(key) { return localStorageService.get('datatable_order_' + key);