1fe39bbec78cdd5c5162f901b9ed11a7595545b1
chmalee
Tue Apr 30 09:36:27 2024 -0700
Fix bug in autocomplete render that was showing null for top level hits to assembly hubs in the species search
diff --git src/hg/js/autocompleteCat.js src/hg/js/autocompleteCat.js
index 5c993fb..33f7c28 100644
--- src/hg/js/autocompleteCat.js
+++ src/hg/js/autocompleteCat.js
@@ -29,33 +29,35 @@
ul.append("
" +
item.category + "
" );
currentCategory = item.category;
}
that._renderItem( ul, item );
});
},
_renderItem: function(ul, item) {
// In order to use HTML markup in the autocomplete, one has to overwrite
// autocomplete's _renderItem method using .html instead of .text.
// http://forum.jquery.com/topic/using-html-in-autocomplete
let clockIcon = '';
if ($("#positionInput").val().length < 2) {
clockIcon = ' ';
}
+ // Hits to assembly hub top level (not individial db names) have no item label,
+ // so use the value instead
return $("")
.data("item.autocomplete", item)
- .append($("").html(clockIcon + item.label))
+ .append($("").html(clockIcon + (item.label !== null ? item.label : item.value)))
.appendTo(ul);
}
});
function toggleSpinner(add, options) {
if (options.baseUrl.startsWith("hgGateway")) {
// change the species select loading image
if (add)
$("#speciesSearch").after("");
else
$("#speciesSpinner").remove();
} else if (options.baseUrl.startsWith("hgSuggest")) {
// change the position input loading spinner
if (add)
$("#positionInput").after("");