src/hg/js/hui.js 1.24

1.24 2009/04/01 23:08:30 tdreszer
Partially enable desirable multi-select changes
Index: src/hg/js/hui.js
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/js/hui.js,v
retrieving revision 1.23
retrieving revision 1.24
diff -b -B -U 4 -r1.23 -r1.24
--- src/hg/js/hui.js	1 Apr 2009 20:12:50 -0000	1.23
+++ src/hg/js/hui.js	1 Apr 2009 23:08:30 -0000	1.24
@@ -806,20 +806,35 @@
 }
 
 function multiSelectBlur(obj)
 {
-    if(obj.value == undefined || obj.value == "")
+    if(obj.value == undefined || obj.value == "") {
         obj.value = "All";
-    if(obj.value == "All") // Close if selected index is 1
+        obj.selectedIndex = 0;
+    }
+    //if(obj.value == "All") // Close if selected index is 1
+    if(obj.selectedIndex == 0) // Close if selected index is 1
+        obj.size=1;
+    /*else if($.browser.msie == false && $(obj).children('option[selected]').length==1) {
+        var ix;
+        for(ix=0;ix<obj.options.length;ix++) {
+            if(obj.options[ix].value == obj.value) {
+                //obj.options[ix].selected = true;
+                obj.selectedIndex = ix;
         obj.size=1;
+                $(obj).trigger('change');
+                break;
+            }
+        }
+    }*/
 }
 
 function multiSelectClick(obj,sizeWhenOpen)
 {
     if(obj.size == 1)
         obj.size=sizeWhenOpen;
-    else
-        multiSelectBlur(obj);
+    else if(obj.selectedIndex == 0)
+        obj.size=1;
 }
 
 // The following js depends upon the jQuery library
 $(document).ready(function()