Skip to content

Commit 3123d38

Browse files
Fix regression in autocompleter - when adding new people/orgs/venues through modal they are not autoselected
Ah the lovely fragile javascript ecosystem, I can't even pin down when or why it broke.
1 parent c93c04e commit 3123d38

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

pipeline/source_assets/js/autocompleter.js

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
11
function changeSelectedValue(obj,pk,text,update_url) { //Pass in JQuery object and new parameters
22
//console.log('Changing selected value');
33
obj.find('option').remove(); //Remove all the available options
4-
obj.append( //Add the new option
5-
$("<option></option>")
6-
.attr("value",pk)
7-
.text(text)
8-
.data('update_url',update_url)
9-
);
10-
obj.selectpicker('render'); //Re-render the UI
11-
obj.selectpicker('refresh'); //Re-render the UI
12-
obj.selectpicker('val', pk); //Set the new value to be selected
4+
obj[0].add(new Option(text, pk, true, true)); // Add new option
5+
//obj.selectpicker('val', pk); //Set the new value to be selected
6+
obj.selectpicker('refresh');
137
obj.change(); //Trigger the change function manually
8+
//console.log(obj);
149
}
1510

1611
function refreshUpdateHref(obj) {

0 commit comments

Comments
 (0)