-
- CRM.$(function($) {
- buildCaseGlobalRelationships(false);
- });
-
- function buildCaseGlobalRelationships(filterSearch) {
- if (filterSearch) {
- oTable.fnDestroy();
- }
- var count = 0;
- var columns = '';
- var sourceUrl = {/literal}"{crmURL p='civicrm/ajax/globalrelationships' h=0 q='snippet=4&caseID='}{$caseID}"{literal};
- sourceUrl = sourceUrl + '&cid={/literal}{$contactID}{literal}';
- sourceUrl = sourceUrl + '&userID={/literal}{$userID}{literal}';
-
- cj('#globalRelationships-selector th').each( function( ) {
- if (cj(this).attr('id') != 'nosort') {
- columns += '{"sClass": "' + cj(this).attr('class') +'"},';
- }
- else {
- columns += '{ "bSortable": false },';
- }
- count++;
- });
-
- columns = columns.substring(0, columns.length - 1 );
- eval('columns =[' + columns + ']');
-
- oTable = cj('#globalRelationships-selector').dataTable({
- "bFilter" : false,
- "bAutoWidth" : false,
- "aaSorting" : [],
- "aoColumns" : columns,
- "bProcessing": true,
- "bJQueryUI": true,
- "asStripClasses" : [ "odd-row", "even-row" ],
- "sPaginationType": "full_numbers",
- "sDom" : '<"crm-datatable-pager-top"lfp>rt<"crm-datatable-pager-bottom"ip>',
- "bServerSide": true,
- "sAjaxSource": sourceUrl,
- "iDisplayLength": 10,
- "fnDrawCallback": function() { setGlobalRelationshipsSelectorClass(); },
- "oLanguage": {
- "sEmptyTable": {/literal}'{ts escape='js' 1=$globalGroupInfo.title}The group %1 has no members.{/ts}'{literal}
- },
- "fnServerData": function ( sSource, aoData, fnCallback ) {
- cj.ajax( {
- "dataType": 'json',
- "type": "POST",
- "url": sSource,
- "data": aoData,
- "success": fnCallback
- } );
- }
- });
- }
-
- function setGlobalRelationshipsSelectorClass( ) {
- cj("#globalRelationships-selector td:last-child").each( function( ) {
- cj(this).parent().addClass(cj(this).text() );
- });
- }
+ CRM.$(function($) {
+ buildCaseGlobalRelationships(false);
+ function buildCaseGlobalRelationships(filterSearch) {
+ if (filterSearch) {
+ oTable.fnDestroy();
+ }
+ var count = 0;
+ var columns = '';
+ var sourceUrl = {/literal}"{crmURL p='civicrm/ajax/globalrelationships' h=0 q='snippet=4&caseID='}{$caseID}"{literal};
+ sourceUrl = sourceUrl + '&cid={/literal}{$contactID}{literal}';
+ sourceUrl = sourceUrl + '&userID={/literal}{$userID}{literal}';
+
+ $('#globalRelationships-selector-{/literal}{$caseID}{literal} th').each( function( ) {
+ if ($(this).attr('id') != 'nosort') {
+ columns += '{"sClass": "' + $(this).attr('class') +'"},';
+ }
+ else {
+ columns += '{ "bSortable": false },';
+ }
+ count++;
+ });
+
+ columns = columns.substring(0, columns.length - 1 );
+ eval('columns =[' + columns + ']');
+
+ oTable = $('#globalRelationships-selector-{/literal}{$caseID}{literal}').dataTable({
+ "bFilter" : false,
+ "bAutoWidth" : false,
+ "aaSorting" : [],
+ "aoColumns" : columns,
+ "bProcessing": true,
+ "bJQueryUI": true,
+ "asStripClasses" : [ "odd-row", "even-row" ],
+ "sPaginationType": "full_numbers",
+ "sDom" : '<"crm-datatable-pager-top"lfp>rt<"crm-datatable-pager-bottom"ip>',
+ "bServerSide": true,
+ "sAjaxSource": sourceUrl,
+ "iDisplayLength": 10,
+ "fnDrawCallback": function() { setGlobalRelationshipsSelectorClass(); },
+ "oLanguage": {
+ "sEmptyTable": {/literal}'{ts escape='js' 1=$globalGroupInfo.title}The group %1 has no members.{/ts}'{literal}
+ },
+ "fnServerData": function ( sSource, aoData, fnCallback ) {
+ $.ajax( {
+ "dataType": 'json',
+ "type": "POST",
+ "url": sSource,
+ "data": aoData,
+ "success": fnCallback
+ });
+ }
+ });
+ }
+
+ function setGlobalRelationshipsSelectorClass( ) {
+ $("#globalRelationships-selector-{/literal}{$caseID}{literal} td:last-child").each( function( ) {
+ $(this).parent().addClass($(this).text() );
+ });
+ }
+ });