From 8968a524a2df044b3f90d1c6fce110993eb8cf85 Mon Sep 17 00:00:00 2001 From: lucas_nz Date: Wed, 30 Sep 2020 18:04:27 +1300 Subject: 1. If scope.id is not zero, we should show "tick" only the filtered monitors on the filter view. 2. Make sure we clear the selections properly too --- www/js/EventCtrl.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/www/js/EventCtrl.js b/www/js/EventCtrl.js index b770dd7c..be1bf1f9 100644 --- a/www/js/EventCtrl.js +++ b/www/js/EventCtrl.js @@ -227,6 +227,11 @@ angular.module('zmApp.controllers') $rootScope.fromString = ""; $rootScope.toString = ""; $rootScope.monitorsFilter=""; + for (var i=0; i < $scope.monitors.length; i++) { + if ($scope.monitors[i] != undefined) { + $scope.monitors[i].Monitor.isChecked = undefined; + } + } } }); @@ -550,6 +555,19 @@ angular.module('zmApp.controllers') nolangFrom = moment($rootScope.fromString).locale('en').format("YYYY-MM-DD HH:mm:ss"); if ($rootScope.toString) nolangTo = moment($rootScope.toString).locale('en').format("YYYY-MM-DD HH:mm:ss"); + if ($scope.id) { + $rootScope.monitorsFilter = "/MonitorId =:" + $scope.id; + //console.log("monitors.length: " + $scope.monitors.length); + for (var i=0; i < $scope.monitors.length; i++) { + if ($scope.monitors[i] != undefined) { + if ($scope.monitors[i].Monitor.Id == $scope.id) + $scope.monitors[i].Monitor.isChecked = true; + else + $scope.monitors[i].Monitor.isChecked = false; + } + } + $scope.id = 0; + } NVR.getEvents($scope.id, currEventsPage, "", nolangFrom, nolangTo, false, $rootScope.monitorsFilter) .then(function (data) { @@ -2083,6 +2101,11 @@ angular.module('zmApp.controllers') $scope.id = 0; $scope.showEvent = false; $scope.footerState = ionPullUpFooterState.MINIMIZED; + for (var i=0; i < $scope.monitors.length; i++) { + if ($scope.monitors[i] != undefined) { + $scope.monitors[i].Monitor.isChecked = undefined; + } + } getInitialEvents(); /* -- cgit v1.2.3