SearchKit - When refreshing after a task, refresh all displays in a form
authorcolemanw <coleman@civicrm.org>
Mon, 2 Oct 2023 05:37:14 +0000 (01:37 -0400)
committercolemanw <coleman@civicrm.org>
Wed, 4 Oct 2023 00:52:21 +0000 (20:52 -0400)
ext/search_kit/ang/crmSearchTasks/traits/searchDisplayTasksTrait.service.js

index a1f7277bfadd71af5a2616293ac2afccdf995662..47e3b51e5a8ba511f55d19d623c4c3f3f4b5d446 100644 (file)
@@ -7,7 +7,7 @@
 
     // TaskManager object is responsible for fetching task metadata for a SearchDispaly
     // and handles the running of tasks.
-    function TaskManager(displayCtrl) {
+    function TaskManager(displayCtrl, $element) {
       var mngr = this;
       var fetchedMetadata;
       this.tasks = null;
       this.refreshAfterTask = function() {
         displayCtrl.selectedRows = [];
         displayCtrl.allRowsSelected = false;
-        displayCtrl.rowCount = undefined;
-        displayCtrl.runSearch();
+        displayCtrl.rowCount = null;
+        displayCtrl.getResultsPronto();
+        // Trigger all other displays in the same form to update.
+        // This display won't update twice because of the debounce in getResultsPronto()
+        $element.trigger('crmPopupFormSuccess');
       };
     }
 
       },
 
       // onInitialize callback
-      onInitialize: [function() {
+      onInitialize: [function($scope, $element) {
         // Instantiate task manager object
         if (!this.taskManager) {
-          this.taskManager = new TaskManager(this);
+          this.taskManager = new TaskManager(this, $element);
         }
       }],