3162d1fec3dffece6f608f15eb6d46f6c46f7436 chmalee Fri Dec 5 16:13:05 2025 -0800 Working version of custom track group 'visible' that is at the top of the group list and has all the currently visible tracks, refs #36609 diff --git src/hg/js/hgTracks.js src/hg/js/hgTracks.js index a136921df6e..97733b15e5b 100644 --- src/hg/js/hgTracks.js +++ src/hg/js/hgTracks.js @@ -976,41 +976,45 @@ // This code also modifies the corresponding hidden fields and the gif's of the +/- img tag. imageV2.markAsDirtyPage(); $(".toggleButton[id$='_button']").each( function (i) { // works for old img type AND new BUTTONS_BY_CSS // - 7: clip '_button' suffix vis.toggleForGroup(this,this.id.substring(0,this.id.length - 7),newState); }); return false; }, initForAjax: function() { // To better support the back-button, it is good to eliminate extraneous form puts // Towards that end, we support visBoxes making ajax calls to update cart. var sels = $('select.normalText,select.hiddenText'); $(sels).on("change", function() { var track = $(this).attr('name'); - if ($(this).val() === 'hide') { + let newVis = $(this).val(); + if (newVis === 'hide') { var rec = hgTracks.trackDb[track]; if (rec) rec.visibility = 0; // else Would be nice to hide subtracks as well but that may be overkill $(document.getElementById('tr_' + track)).remove(); cart.updateSessionPanel(); imageV2.drawHighlights(); $(this).attr('class', 'hiddenText'); } else $(this).attr('class', 'normalText'); + document.querySelectorAll('[name="'+track+'"]').forEach( (sel) => { + sel.value = newVis; + }); cart.setVars([track], [$(this).val()]); imageV2.markAsDirtyPage(); return false; }); // Now we can rid the submt of the burden of all those vis boxes var form = $('form#TrackForm'); $(form).on("submit", function () { $('select.normalText,select.hiddenText').prop('disabled',true); }); $(form).attr('method','get'); }, restoreFromBackButton: function() // Re-enabling vis dropdowns is necessary because initForAjax() disables them on submit.