Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Dropdown in homepage search widget isn't showing

Goran WitchDoc
ServiceNow Employee
ServiceNow Employee

I have created a custom Typeahead search & homepage search Widget.

I did this like 6 months ago and have some flashback that there was a twist to get it to work.

If I type something, the dropdown isn't working like it should. If I press enter I get to the search page and the correct results is showing...Anyone know about this behavior?

This is how it looks like:

find_real_file.png

and if I press enter I get to the search results and it shows me the 6 items I should have seen in the dropdown. If I change the custom homepage to use the OOB typeahead widget here:

find_real_file.png

it works like it should...

//Göran

1 ACCEPTED SOLUTION

found it... when I cloned the widget, the angular ng-template "sp-typahead.html" didn't tag along, and it uses that to show the results...


find_real_file.png



Weird part here is that that template can only be on 1 widget at the time. so when I edited and put it here, it vanished from the first.



so I created a new one for my typeahead with the same data as this template and just changed in the code to go for my template.



//Göran


View solution in original post

5 REPLIES 5

dwolf
Giga Expert

For the typeahead widget you've created did you set-up the CSS? From your screenshot, I think the results are showing but the height is not set.


Goran WitchDoc
ServiceNow Employee
ServiceNow Employee

I cloned the OOB one, and did nothing to the code.. but there must be something else.



I get the same effect on all the typeahead search as well..



but.. if I on a page have both the OOB typeahead widget and the custom one.. it works.. and If I first go to the page where the oob version is and then to the homepage search, it starts to works as well..



but if I got to homepage search first, it doesnt...


I did something similar where I cloned Typeahead Search [typeahead-search] and Homepage Search.



However, for the Homepage Search, I removed the server script and below is what I did in the HTML:


<div id="homepage-search" class="hidden-xs wrapper-lg">


  <div class="wrapper-lg">


  <h1 class="text-center text-4x m-b-lg sp-tagline-color" ng-bind="options.title"></h1>


  <h4 ng-if="options.short_description" class="text-center m-b-lg sp-tagline-color" ng-bind="options.short_description"></h4>


  <widget id="clonedid_typeahead_search"></widget> //add the id value of the clone Typeahead Search


  </div>


</div>




Hope this helps.


found it... when I cloned the widget, the angular ng-template "sp-typahead.html" didn't tag along, and it uses that to show the results...


find_real_file.png



Weird part here is that that template can only be on 1 widget at the time. so when I edited and put it here, it vanished from the first.



so I created a new one for my typeahead with the same data as this template and just changed in the code to go for my template.



//Göran