700f67a16c93f64328383281b236316b55b95558 tdreszer Thu Jun 23 15:32:22 2011 -0700 DDCL improvement on 'first is all' logic diff --git src/hg/js/utils.js src/hg/js/utils.js index c8a5b3e..1d4dc4e 100644 --- src/hg/js/utils.js +++ src/hg/js/utils.js @@ -2479,53 +2479,65 @@ if(($(selector).hasClass('filterComp') && filterCompositeExcludeOptions(selector)) || ($(selector).hasClass('filterTable') && filterTableExcludeOptions(selector))) { // "exclude" items based upon the exclude tag of the true options allCheckboxes.each(function(index) { var item = $(this).parent(); if($(selectOptions[index]).hasClass('excluded')) { $(item).addClass("ui-state-excluded"); } else //if($(item).hasClass("ui-state-excluded")) $(item).removeClass("ui-state-excluded"); }); } } catch (err) {} // OK if filterCompositeExcludeOptions is not defined. + // Show only first as selected if it is selected + if (allCheckboxes[0].checked == true) { + allCheckboxes.each(function(index) { + if (index > 0) + $(this).attr('checked',false); + }); + } } function ddclOnComplete(selector) { // Called by ui.dropdownchecklist.js when selections have been made // Also called at init to fill the selector with current choices // Warning: In IE this gets called when still selecting! var id = $(selector).attr('id'); // If no options are selected, may have to force all if ($(selector).attr('noneIsAll') == 'true') { var chosen = $(selector).find('option:selected'); if (chosen.length == 0) { //$(selector).first('option').first().attr('selected',true); selector.options[0].selected = true; // How to check the first item? var dropWrapper = $('#ddcl-' + id + '-ddw'); $(dropWrapper).find("input").first().attr("checked",true); + } else if (chosen.length == $(selector).find('option').length) { + // If all are chosen then select only the first! + $(chosen).each(function(index) { + if (index > 0) + $(this).attr('selected',false); + }); } } - var msg = ddclTextOfCurrentSelections(selector.options); var control = this.controlWrapper; if (control == null || control == undefined) { // caller is not constant control = $('#ddcl-' + id); } var newColor = ''; if ($(selector).find('option:selected').length == 0) newColor = '#AA0000'; // red //else if (msg.search(/color:/i) == -1) // newColor = 'black'; ddclLabelSet(control,msg,newColor,'Click to select...'); } function ddclReinit(filterBys,force)