I am trying to get autosuggest to work, I can see in the consolelog that suggestionCollection is populated with data, but the drop down never appears.
any help thanks
$(document).ready(function () {
var asbBox = document.getElementById("asbId");
var asb = new (<any>WinJS.UI).AutoSuggestBox(asbBox);
asb.placeholderText = "Enter Postcode or Location";
asb.searchHistoryDisabled = "true";
asbBox.addEventListener("suggestionsrequested", suggestionsRequestedHandler);
asbBox.addEventListener("querysubmitted", querySubmittedHandler);
WinJS.UI.processAll();
});
function suggestionsRequestedHandler(eventObject: any) {
var queryText = eventObject.detail.queryText,
query = queryText.toLowerCase(),
suggestionCollection = eventObject.detail.searchSuggestionCollection;
if (query.length > 2) {
var p = new RemoteData().postData("http://api.xxxxx.com.au/api/LocationViews/SearchLocationViews", { query: query });
p.done(
function completed(request: any) {
var obj = JSON.parse(request.response);
obj.forEach(function (item: any) {
console.log(suggestionCollection)
suggestionCollection.appendQuerySuggestion(item.FormatedLocation);
});
WinJS.UI.processAll();
},
function error(request: any) {
console.log(request);
});
}
}
Alan Mosley - ThatsIT Solutions