7de2982a8966b32914d5d20b76b5f2cf97f7cd7d chmalee Wed Sep 25 15:34:46 2024 -0700 Fix checkbox selection not graying out options as a result of jquery upgrade, refs #13253 diff --git src/hg/js/hui.js src/hg/js/hui.js index 6e43673..9104325 100644 --- src/hg/js/hui.js +++ src/hg/js/hui.js @@ -1204,93 +1204,93 @@ thisForm = thisForm[0]; $(thisForm).attr('action',obj.href); // just attach the straight href $(thisForm).trigger("submit"); return false; // should not get here! } return true; }, topVis: function (show) { var superSel = $('select.visDD'); if (superSel && superSel.length === 1) { superSel = superSel[0]; if (show) { $(superSel).addClass('normalText'); - $(superSel).attr('selectedIndex',1); + $(superSel).prop('selectedIndex',1); $(superSel).removeClass('hiddenText'); } else { - $(superSel).attr('selectedIndex',0); + $(superSel).prop('selectedIndex',0); $(superSel).removeClass('normalText'); $(superSel).addClass('hiddenText'); } } }, plusMinus: function (check) { $("input:checkbox").each(function (i) { - $(this).attr("checked",check); + $(this).prop("checked",check); superT.childChecked(this,1); if (!check) // all are unchecked so we can hide this whole thing. superT.topVis(check); }); }, childChecked: function (cb,defaultVis) { var name = cb.id; name = name.substring(0, name.length - "_check".length); var sel = $('select[name="' + name + '"]'); if (sel && sel.length === 1) { sel = sel[0]; - var selIx = parseInt($(sel).attr('selectedIndex')); + var selIx = sel.selectedIndex; if (cb.checked && selIx === 0) { // What can be done to more intelligently default this? // All to dense? Probably the best idea // When first rendering page? Then how to save? // Logic is: from [+][-] then dense; from cb, then full if (defaultVis === undefined || defaultVis === null) defaultVis = (sel.options.length - 1); // full superT.selChanged(sel,defaultVis); } else if (!(cb.checked) && selIx !== 0) { superT.selChanged(sel,0); } } }, selChanged: function(sel,val) { var selIx = val; if (val === undefined || val === null) // onchange event - selIx = $(sel).attr('selectedIndex'); + selIx = sel.selectedIndex; else // called from childChecked() so set value - $(sel).attr('selectedIndex',val); + $(sel).prop('selectedIndex',val); if (selIx === 0) { $(sel).removeClass('normalText'); $(sel).addClass('hiddenText'); } else { $(sel).removeClass('hiddenText'); $(sel).addClass('normalText'); superT.topVis(true); } if (val === undefined || val === null) { // onchange event only var cb = $('input#'+sel.name+'_check'); if (cb && cb.length === 1) { cb = cb[0]; - $(cb).attr('checked',(selIx > 0)); + $(cb).prop('checked', (selIx > 0)); } } } }; var mat = { // Beginings of matrix object matrix: undefined, dimensions: 0, cellInFocus: undefined, cellHover: function (cell,on) { if (on) { if (mat.cellInFocus)