Skip to content

Commit

Permalink
Fix regression in autocompleter - when adding new people/orgs/venues …
Browse files Browse the repository at this point in the history
…through modal they are not autoselected

Ah the lovely fragile javascript ecosystem, I can't even pin down when or why it broke.
  • Loading branch information
FreneticScribbler committed Jul 21, 2024
1 parent c93c04e commit 3123d38
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions pipeline/source_assets/js/autocompleter.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
function changeSelectedValue(obj,pk,text,update_url) { //Pass in JQuery object and new parameters
//console.log('Changing selected value');
obj.find('option').remove(); //Remove all the available options
obj.append( //Add the new option
$("<option></option>")
.attr("value",pk)
.text(text)
.data('update_url',update_url)
);
obj.selectpicker('render'); //Re-render the UI
obj.selectpicker('refresh'); //Re-render the UI
obj.selectpicker('val', pk); //Set the new value to be selected
obj[0].add(new Option(text, pk, true, true)); // Add new option
//obj.selectpicker('val', pk); //Set the new value to be selected
obj.selectpicker('refresh');
obj.change(); //Trigger the change function manually
//console.log(obj);
}

function refreshUpdateHref(obj) {
Expand Down

0 comments on commit 3123d38

Please sign in to comment.