src/hg/js/hui.js 1.50

1.50 2010/02/08 22:11:26 tdreszer
Big changes to move matrix CB normalizeAll code from js to C. These changes should make the large composites less sluggish
Index: src/hg/js/hui.js
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/js/hui.js,v
retrieving revision 1.49
retrieving revision 1.50
diff -b -B -U 4 -r1.49 -r1.50
--- src/hg/js/hui.js	1 Feb 2010 21:37:55 -0000	1.49
+++ src/hg/js/hui.js	8 Feb 2010 22:11:26 -0000	1.50
@@ -153,8 +153,12 @@
     subCDs = $("input.subCB");
     for(var vIx=1;vIx<arguments.length;vIx++) {
         subCDs = $( subCDs ).filter("."+arguments[vIx]);  // Successively limit list by additional classes.
     }
+    if(state) { // If clicking [+], further limit to only checked ABCs
+        var classes = matAbcCBclasses('unchecked');
+        subCDs = objsFilterByClasses(subCDs,false,classes);  // remove unchecked abcCB classes
+    }
     $( subCDs ).each( function (i) {
         this.checked = state;
         matSubCBsetShadow(this);
     });
@@ -245,9 +249,9 @@
     if(subCB.checked)
         shadowState = 1;
     if(subCB.disabled)
         shadowState -= 2;
-    $("input[type=hidden][name='boolshad\."+subCB.name+"']").val(shadowState);
+    $("#"+subCB.name+"_4way").val(shadowState);
 }
 
 function matChkBoxNormalize(matCB)
 {
@@ -283,35 +287,8 @@
     else
         matCbComplete(matCB,true); // If no subs match then this is determined !
 }
 
-function matChkBoxesNormalizeAll()
-{
-// document:load  Makes sure all matCBs are in one of 3 states (checked,unchecked,indeterminate) based on matching set of subCBs
-    var matCBs = $("input.matCB").not(".abc");
-    var abcCBs = $("input.matCB.abc");
-    var classes = matViewClasses('hidden');
-    if( $(abcCBs).length > 0) {
-        // Should do dim ABC first, then go back and do non-dim ABC with extra restrictions!
-        $(abcCBs).each( function (i) {
-            // do not normaize dim ABC.  These are set only by cart variables
-            if( $(this).is(':checked') == false ) {
-                var classList = $( this ).attr("class").split(" ");
-                classList = aryRemove(classList,"matCB","abc");
-                classes.push( classList );   // builds classes string filter like ".rep2.rep3" which are those mat cbs that are not checked.
-            }
-        } );
-    }
-    $(matCBs).each( function (i) { matChkBoxNormalize(this,classes); } );
-
-    // For each viewDD, enable/disable associated subtracks
-    $('select.viewDD').each( function (i) {
-        var viewClass = this.name.substring(this.name.indexOf(".") + 1,this.name.lastIndexOf("."));
-        matSubCBsEnable((this.selectedIndex > 0),viewClass);
-    });
-    matSubCBsSelected();
-}
-
 function matCbComplete(matCB,complete)
 {
 // Makes or removes the 3rd (indeterminate) matCB state
     // Too many options:
@@ -956,13 +933,16 @@
 ///// Following functions called on page load
 function matInitializeMatrix()
 {
 // Called at Onload to coordinate all subtracks with the matrix of check boxes
+//var start = startTiming();
+//document.body.style.cursor="wait";
     if (document.getElementsByTagName) {
-        matChkBoxesNormalizeAll();  // Note that this needs to be done when the page is first displayed.  But ideally only on clean cart!
+        matSubCBsSelected();
         showOrHideSelectedSubtracks();
-        //enableAllViewCfgLinks();
     }
+//document.body.style.cursor="default";
+//showTiming(start,"matInitializeMatrix()");
 }
 
 function multiSelectLoad(div,sizeWhenOpen)
 {