Merge pull request #2568 from seamuslee001/master
[civicrm-core.git] / templates / CRM / common / customData.tpl
index ef0317bdf74e48fd2fcd0789787a70107bb62e55..1764975b1a6fe40101600c6e4be6230fc2d58729 100644 (file)
@@ -1,6 +1,6 @@
 {*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.3                                                |
+ | CiviCRM version 4.4                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2013                                |
  +--------------------------------------------------------------------+
@@ -29,9 +29,7 @@
 {/if}
 {literal}
 <script type="text/javascript">
-var CRM = CRM || {};
-CRM.buildCustomData = function( type, subType, subName, cgCount, groupID, isMultiple )
-{
+CRM.buildCustomData = function( type, subType, subName, cgCount, groupID, isMultiple ) {
   var dataUrl = {/literal}"{crmURL p=$urlPath h=0 q='snippet=4&type='}"{literal} + type;
 
   if ( subType ) {
@@ -97,6 +95,7 @@ CRM.buildCustomData = function( type, subType, subName, cgCount, groupID, isMult
   cj.ajax({
     url: dataUrl,
     dataType: 'html',
+    async: false,
     success: function(response) {
       var target = cj(fname);
       var storage = {};
@@ -112,7 +111,7 @@ CRM.buildCustomData = function( type, subType, subName, cgCount, groupID, isMult
           storage[id] = cj(this).detach();
         }
       });
-      target.html(response);
+      target.html(response).trigger('crmLoad');
       target.children().each(function() {
         var id = cj(this).attr('id');
         if (id && storage[id]) {