EntityRef filter UI fixes
authorColeman Watts <coleman@civicrm.org>
Fri, 30 Oct 2015 00:30:52 +0000 (20:30 -0400)
committerColeman Watts <coleman@civicrm.org>
Fri, 30 Oct 2015 00:30:52 +0000 (20:30 -0400)
js/Common.js

index 136cd3f47a61c7b6fffc880ee5eb1cd747fd4937..ed6f9d32d6225fa765e195ce3f96dd8ec5d1d714 100644 (file)
@@ -558,11 +558,12 @@ if (!CRM.vars) CRM.vars = {};
                 // Once a filter has been chosen, rerender create links and refocus the search box
                 $el.select2('close');
                 $el.select2('open');
+              } else {
+                $('.crm-entityref-links', '#select2-drop').replaceWith(renderEntityRefCreateLinks($el));
               }
             })
             .on('change.crmEntity', 'select.crm-entityref-filter-key', function() {
-              var filter = $el.data('user-filter') || {};
-              filter.key = $(this).val();
+              var filter = {key: $(this).val()};
               $(this).toggleClass('active', !!filter.key);
               $el.data('user-filter', filter);
               loadEntityRefFilterOptions($el);
@@ -854,7 +855,7 @@ if (!CRM.vars) CRM.vars = {};
           });
       }
     } else {
-      $valField.hide();
+      $valField.hide().val('').change();
     }
   }