71693ffac416f180630634b9efc2af41f8709e09
tdreszer
  Fri Jan 20 14:04:56 2012 -0800
Fix to subtrack vis not getting into the cart when populated via the wrench. 4665
diff --git src/hg/js/subCfg.js src/hg/js/subCfg.js
index 8d5fddf..275b2c4 100644
--- src/hg/js/subCfg.js
+++ src/hg/js/subCfg.js
@@ -603,67 +603,67 @@
         if ($(obj).hasClass('disabled'))
             return;
         var classList = $( obj ).attr("class").split(" ");
         classList = aryRemove(classList,["disabled"]);
         var view = classList[classList.length - 1]; // This relies on view being the last class!!!
         var selectHtml  = "<SELECT name='"+subtrack+"' class='normalText subVisDD "+view+"'";
             selectHtml += " style='width:70px;'>";
         var selected = $(obj).text();
         var visibilities = ['hide','dense','squish','pack','full'];
         $(visibilities).each( function (ix) {
              selectHtml += "<OPTION"+(visibilities[ix] == selected ? " SELECTED":"")+">";
              selectHtml += visibilities[ix]+"</OPTION>";
         });
         selectHtml += "</SELECT>";
         $(obj).replaceWith(selectHtml);
-        if (open) {
             var newObj = $("select[name='"+subtrack+"']");
+        if (open) {
             $(newObj).css({'zIndex':'2','vertical-align':'top'});
             $(newObj).attr('size',5);
             $(newObj).one('blur',function (e) {
                 $(this).attr('size',1);
                 $(this).unbind('click');
             });
             $(newObj).one('click',function (e) {
                 $(this).attr('size',1);
                 $(this).unbind('blur');
             });
+            $(newObj).focus();
+        }
             $(newObj).change(function (e) {
                 if ($(this).attr('size') > 1) {
                     $(this).attr('size',1);
                     $(this).unbind('blur');
                     $(this).unbind('click');
                 }
                 if (this.selectedIndex == 0) { // setting to hide so uncheck and disable.
                     // Easiest is to uncheck subCB and reset vis
                     //    so that the reverse action makes sense
                     var subCb = normed($("input[name='" + this.name + "_sel']"));
                     if (subCb != undefined) {
                         subCfg.checkOneSubtrack(subCb,false,true);
                         subCfg.inheritSetting(this,true);
                     } else {
                         warn('DEBUG: Cant find subCB for ' + this.name);
                     }
                 } else {
                     subCfg.markChange(e,this);
                     // if just being made visible then composite to full?  NO (implications to other subs)
                     // Make view visible?  NO (subtrack override)
                     // reshape?  NO (much too complex)
                 }
             });
-            $(newObj).focus();
-        }
     },
 
     enableCfg: function (subCb,setTo)
     { // Enables or disables subVis and wrench
         var tr = normed($(subCb).closest('tr'));
         if (tr == undefined) {
             warn("DEBUG: subCfg.enableCfg() could not find TR for CB: "+subCb.name);
             return false;
         }
         var subFaux = normed($(tr).find('div.subVisDD'));
         if (subFaux != undefined) {
             if (setTo == true)
                 $(subFaux).removeClass('disabled');
             else
                 $(subFaux).addClass('disabled');