CRM-15858 - Fix changeLog display of custom data
[civicrm-core.git] / templates / CRM / common / TabHeader.js
index 429ec7660fa399349a44d94bddeec4a59464b323..9433900c20df626e16eeb1bbe5c8994b1ca8be3c 100644 (file)
@@ -124,14 +124,24 @@ CRM.$(function($) {
   };
 
   /**
-   * Refresh tab immediately if it is active, otherwise ensure it will be refreshed next time the user clicks on it
+   * Refresh tab immediately if it is active (or force=true)
+   * otherwise ensure it will be refreshed next time the user clicks on it
+   *
    * @param tab
+   * @param force
    */
-  CRM.tabHeader.resetTab = function(tab) {
+  CRM.tabHeader.resetTab = function(tab, force) {
     var $panel = CRM.tabHeader.getTabPanel(tab);
     if ($(tab).hasClass('ui-tabs-active')) {
       $panel.crmSnippet('refresh');
     }
+    else if (force) {
+      if ($panel.data("civiCrmSnippet")) {
+        $panel.crmSnippet('refresh');
+      } else {
+        $("#mainTabContainer").trigger('tabsbeforeload', [{panel: $panel, tab: $(tab)}]);
+      }
+    }
     else if ($panel.data("civiCrmSnippet")) {
       $panel.crmSnippet('destroy');
     }