3f9c57f384ccee0d8f8de53d10b0378addfbde33
tdreszer
  Wed Nov 16 12:41:05 2011 -0800
Fixed bug where track search advanced ddcl's were being duplicated.
diff --git src/hg/js/ddcl.js src/hg/js/ddcl.js
index 723b9e2..f870f99 100644
--- src/hg/js/ddcl.js
+++ src/hg/js/ddcl.js
@@ -156,37 +156,37 @@
     },
 
     reinit: function (filterBys,force) {
         // ReInitialize the DDCLs (drop-down checkbox-list)
         // This is done when the track search with tabs gets switched to advanced tab
         // because the DDCLs were setup on hidden filterBys and dimensiuons are wrong.
         // if not force, then only reinit when the dimensions are suspect
 
         if (filterBys.length < 1)
             return;
 
         $(filterBys).each( function(i) { // Do this by 'each' to set noneIsAll individually
             var multiSelect = this;
             if (!force) { // condition on bad dimensions
                 var id = $(multiSelect).attr('id');
-                control = $('#ddcl-' + id);
-                if (control != null && control != undefined) {
+                control = normed($('#ddcl-' + id));
+                if (control == undefined)
+                    return;                            // This is being called before normal init
                     var controlSelector = $(control).find(".ui-dropdownchecklist-selector");
                     if ($(controlSelector).width() > 20)
                         return;  // Dimensions look okay
                 }
-            }
             $(multiSelect).dropdownchecklist("destroy");
             $(multiSelect).show(); // necessary to get dimensions
             ddcl.setup(multiSelect,'noneIsAll');
         });
     },
 
     setup: function (obj) {
         // Initialize the multiselect as a DDCL (drop-down checkbox-list)
         //mySelf = this; // There is no need for a "mySelf" unless this object is being instantiated.
 
         // Defaults
         var myFirstIsAll = true;
         var myNoneIsAll  = false;
         var myIcon       = null;
         var myEmptyText  = 'Select...';