Skip to content

Commit

Permalink
Merge pull request #9 from james0048/master
Browse files Browse the repository at this point in the history
Underline Autocomplete and Select single remaining filtered list
  • Loading branch information
doyle-johnpaul authored Jul 17, 2020
2 parents 1c4a543 + 5a559ad commit 16f36b5
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion custom_ROToolbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -1041,7 +1041,11 @@ function createAutoComplete(tag, tagElement) {
},
data: "Data"
}
}),
}),
select: function(e){
//underlines text in picker to show that an item was selected
e.sender.element[0].style.textDecoration = "underline";
},
change: function(e) {
var newData = [];
if (multiselect === 'True') {
Expand All @@ -1055,6 +1059,16 @@ function createAutoComplete(tag, tagElement) {
} else {
var dataItem = this.dataItem();

//clear underline on change
(document.getElementById("ac"+targetId)).style.textDecoration = ""

//if clicking out of the autocomplete and there is only one item in the filtered list set it to the selected item and underline it
if(dataItem == undefined && this.dataSource._view.length == 1){
dataItem = this.dataSource._view[0];
(document.getElementById("ac"+targetId)).style.textDecoration = "underline"
this.value(this.dataSource._view[0].DisplayName);
}

if (_.isUndefined(dataItem.BaseId)) {
dataItem.BaseId = !_.isUndefined(dataItem.Id) ? dataItem.Id : null;
}
Expand Down

0 comments on commit 16f36b5

Please sign in to comment.