05e67c59a20a5d00b810a981aef3b00c5bef82e1 max Fri Sep 20 06:03:18 2024 -0700 more features to hubtools: search in both parent and subdirs, better docs diff --git src/hg/js/subCfg.js src/hg/js/subCfg.js index e7e843d..74612f1 100644 --- src/hg/js/subCfg.js +++ src/hg/js/subCfg.js @@ -431,38 +431,51 @@ } else { // No view so, simple var visText = 'hide'; if (parentVis === 1) visText = 'dense'; else if (parentVis === 2) { if (subCfg.canPack) visText = 'squish'; else visText = 'full'; } else if (parentVis === 3) visText = 'pack'; else if (parentVis === 4) visText = 'full'; var children = subCfg.visChildrenFind(parentObj); + + var checkedCount = 0; $(children).each(function (i) { + // the checkbox is in the right before the one of $(this) + if ($(this).parent().prev().find("[type='checkbox']")[0].checked) + checkedCount++; + + // apply the visibility to the subtrack if ($(this).hasClass('fauxInput')) { $(this).text(visText); } else { $(this).attr('selectedIndex',parentVis); subCfg.clearChange(this); } }); + + // when nothing is checked, the visibility has been applied but everything is still hidden. + // This is probably not what the user wanted, so in lack of a better idea, we select all checkboxes + if (checkedCount === 0) + // check all checkboxes + $(".subCB[type='checkbox']").attr("checked", "checked"); } } else { // First get composite vis to limit with var compObj = subCfg.compositeObjFind(undefined); if (!compObj) { warn('DEBUG: Could not find composite vis object!'); return false; } subCfg.propagateViewVis(parentObj,compObj.selectedIndex); } }, inheritSetting: function (childObj,force) { // update value if parents values override child values. var myParents = subCfg.parentsFind(childObj);