Skip to content

Commit

Permalink
show the value of phenotype which is selected on the homepage (#186)
Browse files Browse the repository at this point in the history
  • Loading branch information
preetisi authored Oct 15, 2019
1 parent f1a40bf commit c675038
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion grails-app/views/trait/_traitTableHeader.gsp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
$( document ).ready(function() {
mpgSoftware.manhattanplotTableHeader.fillSampleGroupDropdown('<%=phenotypeKey%>');
mpgSoftware.manhattanplotTableHeader.fillPhenotypesDropdown('T2D', 'manhattanPhenotypeDropdownWrapper','phenotypeDropdown');
mpgSoftware.manhattanplotTableHeader.fillPhenotypesDropdown('<%=params.trait%>' || 'T2D', 'manhattanPhenotypeDropdownWrapper','phenotypeDropdown');
mpgSoftware.manhattanplotTableHeader.fillRegionalTraitAnalysis('<%=phenotypeKey%>','');
});
</script>
Expand Down
18 changes: 13 additions & 5 deletions web-app/js/lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ var UTILS = {
}
},
// phenotypesToOmit is an array of the phenotype keys that should not be included
fillPhenotypeCompoundDropdown: function (dataSetJson,phenotypeDropDownIdentifier,includeDefault, phenotypesToOmit,portaltype) { // help text for each row
fillPhenotypeCompoundDropdown: function (dataSetJson,phenotypeDropDownIdentifier,includeDefault, phenotypesToOmit,selectedPhenotype) { // help text for each row
if ((typeof dataSetJson !== 'undefined') &&
(typeof dataSetJson["is_error"] !== 'undefined')&&
(dataSetJson["is_error"] === false))
Expand All @@ -402,12 +402,20 @@ var UTILS = {
if(_.includes(phenotypesToOmit, groupContents[j][0])) {
continue;
}
options.append($("<option />").val(groupContents[j][0])
// add some whitespace to create indentation
.html("&nbsp;&nbsp;&nbsp;" + groupContents[j][1]));
if(selectedPhenotype === groupContents[j][0]){
options.append($("<option selected='' />").val(groupContents[j][0]).html("&nbsp;&nbsp;&nbsp;" + groupContents[j][1]));
}
else{
options.append($("<option />").val(groupContents[j][0])
// add some whitespace to create indentation
.html("&nbsp;&nbsp;&nbsp;" + groupContents[j][1]));

}

}
options.append("</optgroup>");
$(phenotypeDropDownIdentifier).selectpicker('refresh');
//$(phenotypeDropDownIdentifier).selectpicker('refresh');

});
// enable the input
options.prop('disabled', false);
Expand Down

0 comments on commit c675038

Please sign in to comment.