Add index to Api4Ctrl
authorColeman Watts <coleman@civicrm.org>
Sun, 9 Jun 2019 13:10:06 +0000 (09:10 -0400)
committerCiviCRM <info@civicrm.org>
Wed, 16 Sep 2020 02:13:18 +0000 (19:13 -0700)
ext/afform/core/ang/afformCore/Api4Ctrl.js

index 32ae530fd1998f085f8a45826b1918e8cdc503df..67fac36b4de4c0235564e114a675e0c8603b9685 100644 (file)
         ctrl.entity = parts[0];
         ctrl.action = parts[1];
         ctrl.params = parts[2];
+        ctrl.index = parts[3];
         ctrl.result = {};
         ctrl.loading = ctrl.firstLoad = true;
 
         ctrl.refresh = function refresh() {
           ctrl.loading = true;
           crmThrottle(function () {
-            return crmApi4(ctrl.entity, ctrl.action, ctrl.params)
+            return crmApi4(ctrl.entity, ctrl.action, ctrl.params, ctrl.index)
               .then(function (response) {
                 ctrl.result = response;
                 ctrl.loading = ctrl.firstLoad = false;
@@ -39,7 +40,7 @@
 
         var mode = $scope.affApi4Refresh ? $scope.affApi4Refresh : 'auto';
         switch (mode) {
-          case 'auto': $scope.$watchCollection('affApi4Ctrl.params', ctrl.refresh); break;
+          case 'auto': $scope.$watch('affApi4Ctrl', ctrl.refresh, true); break;
           case 'init': ctrl.refresh(); break;
           case 'manual': break;
           default: throw 'Unrecognized refresh mode: '+ mode;