371735a66b8471513c586997a77df59fb439c0c4 tdreszer Mon Apr 29 14:45:20 2013 -0700 More experimentation on buttons/controls with Brooke for haplotypes. At this point, we agree to leave things as they are until a wider audience has a chance to weigh in. diff --git src/hg/js/alleles.js src/hg/js/alleles.js index 1e27139..72a1a73 100644 --- src/hg/js/alleles.js +++ src/hg/js/alleles.js @@ -106,39 +106,41 @@ var col = $('table#alleles').find('TH#' + persistSortColId); if (col != undefined && col.length != 0) { var colIx = Number( $(col).attr('cellIndex') ); $(col).click(); if (persistSortReverse) {// click twice if reverse order! persistSortReverse = false; // Needed so that it is set again setTimeout("$('table#alleles').find('TH#" + persistSortColId + "').click();", 50); } } } // Make sure that sort command saves the coumn for persistence $('table#alleles').find('TH').click(function (e) { afterSort(this); }); + /* // Want to show rare haplotypes if they were seen before ajax update if (persistRareHapsShown) { alleles.rareAlleleToggle( $('input#' + sectionName + "_rareHaps"), false ); } // Want to show scores if they were seen before ajax update if (persistScoresShown) { alleles.scoresToggle( $('input#' + sectionName + "_score"), false ); } + */ // Persist on lighlite as red if (hiliteId != '') hiliteSpecial( hiliteId ); } function propgateTitle(obj) { // Adds this objects title to all other objs with the same class // Relies upon a span and fixed width text // Find pointer position within text // Is there a title? var theTitle = obj.title; if (theTitle == undefined || theTitle.length === 0) return; @@ -274,70 +276,90 @@ var over = ((e.pageX - $(obj).offset().left) / seqPxPerPos) + 0.5; // round up $(obj).attr('title',over.toFixed(0)); // title is simply position }, rareAlleleToggle: function (btn,setCart) { // toggle the visibility of rare alleles var trs = $('table#alleles tbody tr.allele'); persistRareHapsShown = ($(btn).val().indexOf('Show') != -1); if (persistRareHapsShown) { $(trs).filter('.rare').removeClass('hidden'); var counts = $(trs).filter(':visible').length + ' of ' + $(trs).length; $('span#alleleCounts').text( 'All gene haplotypes shown: ' + counts ); $('span#alleleCounts').addClass('textAlert'); $(btn).val('Hide rare haplotypes'); if (setCart == undefined || setCart) - setCartVar(sectionName + '_rareHaps','set'); + setCartVar(btn.id,'set'); } else { $(trs).filter('.rare').addClass('hidden'); var counts = $(trs).filter(':visible').length + ' of ' + $(trs).length; $('span#alleleCounts').text( 'Common gene haplotypes shown: ' + counts ); $('span#alleleCounts').removeClass('textAlert'); $(btn).val('Show rare haplotypes'); if (setCart == undefined || setCart) - setCartVar(sectionName + '_rareHaps','[]'); + setCartVar(btn.id,'[]'); } hilitesResize(); }, scoresToggle: function (btn,setCart) { // toggle the visibility of scores - persistScoresShown = ($(btn).val().indexOf('Include') != -1); + persistScoresShown = ($(btn).val().indexOf('Show') != -1); if (persistScoresShown) { $('table#alleles').find('.score').removeClass('hidden'); $(btn).val('Hide scoring'); if (setCart == undefined || setCart) - setCartVar(sectionName + '_score','set'); + setCartVar(btn.id,'set'); } else { $('table#alleles').find('.score').addClass('hidden'); - $(btn).val('Include scoring'); + $(btn).val('Show scoring'); if (setCart == undefined || setCart) - setCartVar(sectionName + '_score','[]'); + setCartVar(btn.id,'[]'); } hilitesResize(); }, - toggleButton: function (btn,val) - { // toggles feature that requires ajax - // Note that ID is same as cart variable and value is boolean "exists" - if (val != '') { - ajaxRequest(btn.id + '=set'); + scoresShow: function (obj,val) + { // toggle the visibility of scores + persistScoresShown = (val == 'set'); + if (persistScoresShown) { + $('table#alleles').find('.score').removeClass('hidden'); + $(obj).val('[]'); } else { - ajaxRequest(btn.id + '=[]'); // Will remove cart variable + $(obj).val('set'); + $('table#alleles').find('.score').addClass('hidden'); } + setCartVar(obj.id,val); + hilitesResize(); }, + // TODO: Would be good to hide pop and popScore columns, instead of ajax setAndRefresh + /* popShow: function (obj,val) + { // toggle the visibility of scores + persistScoresShown = (val == 'set'); + if (val == 'set') { + return setAndRefresh(obj.id,val) + $('table#alleles').find('.score').removeClass('hidden'); + //$(obj).val('[]'); + } else { + $(obj).val('set'); + $('table#alleles').find('.pop').addClass('hidden'); + } + setCartVar(obj.id,val); + hilitesResize(); + },*/ + setAndRefresh: function (varName,val) { // Resets all display options to defaults ajaxRequest(varName + '=' + val); return false; // Fake link }, initialize: function (sectionId) { // Initialize or reinitailze (after ajax) the sortable table // This whole section could be renamed //if (sectionId != undefined && sectionId.length !== 0) // sectionName = sectionId; initSortTable();