{*
+--------------------------------------------------------------------+
- | CiviCRM version 4.3 |
+ | CiviCRM version 4.5 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013 |
+ | Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
{/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 ) {
if ( subName ) {
dataUrl = dataUrl + '&subName=' + subName;
cj('#customData' + subName ).show();
- } else {
+ }
+ else {
cj('#customData').show();
}
if ( groupID ) {
- dataUrl = dataUrl + '&groupID=' + groupID;
+ dataUrl = dataUrl + '&groupID=' + groupID;
}
{/literal}
if ( !cgCount ) {
cgCount = 1;
var prevCount = 1;
- } else if ( cgCount >= 1 ) {
+ }
+ else if ( cgCount >= 1 ) {
var prevCount = cgCount;
cgCount++;
}
if ( isMultiple ) {
- var fname = '#custom_group_' + groupID + '_' + prevCount;
+ var fname = '#custom_group_' + groupID + '_' + prevCount;
if (cj(".add-more-link-" + groupID + "-" + prevCount ).length) {
cj(".add-more-link-" + groupID + "-" + prevCount).hide();
- } else {
- cj("#add-more-link-"+prevCount).hide();
}
- } else {
+ else {
+ cj("#add-more-link-"+prevCount).hide();
+ }
+ }
+ else {
if ( subName && subName != 'null' ) {
var fname = '#customData' + subName ;
- } else {
+ }
+ else {
var fname = '#customData';
}
}
cj.ajax({
url: dataUrl,
dataType: 'html',
+ async: false,
success: function(response) {
var target = cj(fname);
var storage = {};
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]) {
storage = null;
}
});
-
};
</script>