Developer forum

Forum » Swift » Typeahead 5 elements limitation

Typeahead 5 elements limitation

Mario Santos Dynamicweb Employee
Mario Santos
Reply

Hi there,

The displaySuggestions is only displaying if there are more than 5 li elements. Shouldn't it display if there are any? In this website we are not using the content search only products. But, as you can see if we search for kodiak we got 2 products but those are never displayed.
https://dev-tlc.mydwsite2.com/Default.aspx?ID=218&defaultpdpId=null&redirect=false&eq=kodiak

displaySuggestions: function (listElements, searchField) {
   if (listElements.length > 5) {
      var closestDropdown = searchField.closest(".js-type-ahead-dropdown");
      var dropdownMenu = closestDropdown.querySelector(".js-type-ahead-menu");

      dropdownMenu.innerHTML = "";

      listElements.forEach(function (element) {
         dropdownMenu.appendChild(element)
      });

      Typeahead.showSearchResults(searchField);
   }
},

 

BR, Mario


Replies

 

You must be logged in to post in the forum