CRM-10635 : parents processing on initial load of manage display screen of groups
authorPratik Joshi <pratik.joshi@webaccess.co.in>
Wed, 20 Nov 2013 09:25:03 +0000 (14:55 +0530)
committerPratik Joshi <pratik.joshi@webaccess.co.in>
Wed, 20 Nov 2013 09:25:03 +0000 (14:55 +0530)
templates/CRM/Group/Form/Search.tpl

index 570a40e5b03381fdf4bf0ca7bce9e5473dd40053..e3d2e46f8267401e31d18678060c970ac0ea6540 100644 (file)
 {literal}
 <script type="text/javascript">
 cj( function() {
-  buildGroupSelector( true );
+  // for CRM-11310 and CRM-10635 : processing just parent groups on initial display
+  // passing '1' for parentsOnlyArg to show parent child heirarchy structure display
+  // on initial load of manage group page and
+  // also to handle search filtering for initial load of same page.
+  buildGroupSelector(true, 1);
   cj('#_qf_Search_refresh').click( function() {
     buildGroupSelector( true );
   });
 });
 
-function buildGroupSelector( filterSearch ) {
+function buildGroupSelector( filterSearch, parentsOnlyArg ) {
     if ( filterSearch ) {
         if (typeof crmGroupSelector !== 'undefined') {
           crmGroupSelector.fnDestroy();
@@ -109,6 +113,11 @@ function buildGroupSelector( filterSearch ) {
         var ZeroRecordText = {/literal}'{ts escape="js"}<div class="status messages">No Groups have been created for this site.{/ts}</div>'{literal};
     }
 
+    // this argument should only be used on initial display i.e onPageLoad
+    if (typeof parentsOnlyArg !== 'undefined') {
+      parentsOnly = parentsOnlyArg;
+    }
+
     var columns = '';
     var sourceUrl = {/literal}'{crmURL p="civicrm/ajax/grouplist" h=0 q="snippet=4"}'{literal};
     var showOrgInfo = {/literal}"{$showOrgInfo}"{literal};