Skip to content

Commit

Permalink
Fix search suggestions display issue (#199)
Browse files Browse the repository at this point in the history
  • Loading branch information
wikumChamith authored Sep 30, 2024
1 parent d4f59f2 commit 8c80024
Showing 1 changed file with 17 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -231,30 +231,40 @@ function CreateCallback(options) {
// between the image and the identifier
var textShown = " ";

if (person.identifier)
textShown += person.identifier;

if (person.identifier) {
textShown += $j('<div/>').text(person.identifier).html();
}

textShown += " ";

textShown += person.personName;
var personName = "";
if (person.givenName !== "null") {
personName += person.givenName + " ";
}
if (person.middleName !== "null") {
personName += person.middleName + " ";
}
if (person.familyName !== "null") {
personName += person.familyName;
}

textShown += $j('<div/>').text(personName).html()

// highlight each search term in the results
textShown = highlightWords(textShown, origQuery);

var ageText = "";
if (person.age) {
ageText = " (" + person.age + " " + omsgs.yearsOld + ")";
ageText = $j('<div/>').text(ageText).html()
}

// append the gender image and age AFTER word highlighting so regex doesn't match it

textShown = imageText + textShown + ageText; // space was inserted into beginning of 'textShown' var

textShown = $j('<div/>').text(textShown).html()

// wrap each result in a span tag (needed?)
textShown = "<span class='autocompleteresult'>" + textShown + "</span>";

personNameEscaped = $j('<div/>').text(person.personName).html();
personIdEscaped = $j('<div/>').text(person.personId).html();
return { label: textShown, value: personNameEscaped, id: personIdEscaped, object: person };
Expand Down

0 comments on commit 8c80024

Please sign in to comment.