Skip to content

Commit

Permalink
fix: force relation form select2 to use html
Browse files Browse the repository at this point in the history
  • Loading branch information
b1rger committed Nov 4, 2024
1 parent dd9f4e4 commit 73965c1
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions apis_core/relations/static/js/relation_dialog.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
function tohtml(item) {
var $result = $('<span>');
$result.html(item.text);
return $result;
}
document.body.addEventListener("reinit_select2", function(evt) {
form = document.getElementById(evt.detail.value);
form.querySelectorAll(".listselect2").forEach(element => {
Expand All @@ -6,6 +11,8 @@ document.body.addEventListener("reinit_select2", function(evt) {
url: $(element).data("autocomplete-light-url"),
},
dropdownParent: $(form),
templateResult: tohtml,
templateSelection: tohtml,
});
});
$('.select2-selection').addClass("form-control");
Expand Down

0 comments on commit 73965c1

Please sign in to comment.