src/hg/js/hui.js 1.22
1.22 2009/03/13 23:35:43 tdreszer
Add support for enable/disabling checkboxes by having 4 state boolShad hidden inputs
Index: src/hg/js/hui.js
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/js/hui.js,v
retrieving revision 1.21
retrieving revision 1.22
diff -b -B -U 4 -r1.21 -r1.22
--- src/hg/js/hui.js 9 Mar 2009 18:37:42 -0000 1.21
+++ src/hg/js/hui.js 13 Mar 2009 23:35:43 -0000 1.22
@@ -69,9 +69,13 @@
var classes = OneOrMoreClasses.split(" ");
while(classes.length > 0) {
JustTheseCBs = JustTheseCBs.filter("."+classes.pop());
}
- JustTheseCBs.each( function (i) { this.checked = true; hideOrShowSubtrack(this); } );
+ JustTheseCBs.each( function (i) {
+ this.checked = true;
+ setCheckBoxShadow(this);
+ hideOrShowSubtrack(this);
+ });
}
}
}
}
@@ -132,9 +136,13 @@
// CBs = CBs.not("."+views[vIx]); // Successively limit list by additional classes.
// }
// }
//}
- CBs.each( function (i) { this.checked = state; hideOrShowSubtrack(this); } )
+ CBs.each( function (i) {
+ this.checked = state;
+ setCheckBoxShadow(this);
+ hideOrShowSubtrack(this);
+ });
return true;
}
@@ -152,13 +160,28 @@
// CBs = CBs.filter(":not(."+views[vIx]+")"); // Successively limit list by additional classes.
// }
// }
//}
- CBs.each( function (i) { this.checked = state; hideOrShowSubtrack(this);} )
+ CBs.each( function (i) {
+ this.checked = state;
+ setCheckBoxShadow(this);
+ hideOrShowSubtrack(this);
+ });
return true;
}
+function setCheckBoxShadow(CB)
+{
+// Since CBs only get into cart when enabled/checked, the shadow control enables cart to know other states
+ var shadowState = 0;
+ if(CB.checked)
+ shadowState = 1;
+ if(CB.disabled)
+ shadowState -= 2;
+ $("input[name='boolshad."+CB.name+"']").val(shadowState);
+}
+
function matEnableSubtrackCheckBoxes(state)
{
// Enables/Disables subtracks checkboxes. If additional arguments are passed in, the list of CBs will be narrowed by the classes
var CBs = $("input.subtrackCB");
@@ -172,9 +195,13 @@
// CBs = CBs.filter(":not(."+views[vIx]+")"); // Successively limit list by additional classes.
// }
// }
//}
- CBs.each( function (i) { this.disabled = !state; hideOrShowSubtrack(this); } )
+ CBs.each( function (i) {
+ this.disabled = !state;
+ setCheckBoxShadow(this);
+ hideOrShowSubtrack(this);
+ });
return true;
}
@@ -184,8 +211,9 @@
// Clicking/unclicking the corresponding matrix CB. Also the
// subtrack may be hidden as a result.
//if(subCBtoMatCB)
// matChkBoxNormalizeMatching(subCb);
+ setCheckBoxShadow(subCb);
hideOrShowSubtrack(subCb);
}
function compositeCfgUpdateSubtrackCfgs(inp)