CRM-13573 : fix to process search criteria on page load as well
[civicrm-core.git] / templates / CRM / Group / Form / Search.tpl
index 35b03512f7c5cfcd300818c402631efa09f9e20b..570a40e5b03381fdf4bf0ca7bce9e5473dd40053 100644 (file)
@@ -1,6 +1,6 @@
 {*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.3                                                |
+ | CiviCRM version 4.4                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2013                                |
  +--------------------------------------------------------------------+
@@ -91,7 +91,7 @@
 {literal}
 <script type="text/javascript">
 cj( function() {
-  buildGroupSelector( false );
+  buildGroupSelector( true );
   cj('#_qf_Search_refresh').click( function() {
     buildGroupSelector( true );
   });
@@ -99,7 +99,9 @@ cj( function() {
 
 function buildGroupSelector( filterSearch ) {
     if ( filterSearch ) {
-        crmGroupSelector.fnDestroy();
+        if (typeof crmGroupSelector !== 'undefined') {
+          crmGroupSelector.fnDestroy();
+        }
         var parentsOnly = 0;
         var ZeroRecordText = '<div class="status messages">{/literal}{ts escape="js"}No matching Groups found for your search criteria. Suggestions:{/ts}{literal}<div class="spacer"></div><ul><li>{/literal}{ts escape="js"}Check your spelling.{/ts}{literal}</li><li>{/literal}{ts escape="js"}Try a different spelling or use fewer letters.{/ts}{literal}</li><li>{/literal}{ts escape="js"}Make sure you have enough privileges in the access control system.{/ts}{literal}</li></ul></div>';
     } else {