Javascript WinJS不显示自动建议框
我对WinJS有问题。我不明白这个问题。我想用数据项填充(并且我这样做了)autosuggestbox。之后,通常它必须显示autosuggestbox。但是WinJS并没有列出这个列表 家庭控制器: 事件处理程序:Javascript WinJS不显示自动建议框,javascript,typescript,winjs,Javascript,Typescript,Winjs,我对WinJS有问题。我不明白这个问题。我想用数据项填充(并且我这样做了)autosuggestbox。之后,通常它必须显示autosuggestbox。但是WinJS并没有列出这个列表 家庭控制器: 事件处理程序: static stationRequest(event: CustomEvent) { var query = <string>event.detail.queryText; var suggestionCollection = event.detail
static stationRequest(event: CustomEvent) {
var query = <string>event.detail.queryText;
var suggestionCollection = event.detail.searchSuggestionCollection;
var callback = function (response) {
event.detail.setPromise(WinJS.Promise.then(null, function () {
var _locations: Array<Object> = JSON.parse(response.responseText).LocationList.StopLocation;
$("#response").text(JSON.stringify(_locations));
_locations.forEach(function (obj: ILocation, index, _loc) {
suggestionCollection.appendQuerySuggestion(obj.name);
});
event.detail.linguisticDetails.queryTextAlternatives.forEach(
function (element, index, array) {
if (element.substr(0, query.length).toLocaleLowerCase() === query) {
suggestionCollection.appendQuerySuggestion(element);
}
});
}));
};
if (query.length > 3) {
API.stationRequest(query, callback);
}
}
静态站点请求(事件:CustomEvent){
var query=event.detail.queryText;
var suggestionCollection=event.detail.searchSuggestionCollection;
var callback=函数(响应){
event.detail.setPromise(WinJS.Promise.then)(null,函数(){
var_locations:Array=JSON.parse(response.responseText).LocationList.StopLocation;
$(“#响应”).text(JSON.stringify(_位置));
_位置。forEach(功能(对象:i位置、索引、位置){
suggestionCollection.appendQuerySuggestion(对象名称);
});
event.detail.languationDetails.QueryTextAlternations.forEach(
函数(元素、索引、数组){
if(element.substr(0,query.length).toLocaleLowerCase()==query){
suggestionCollection.appendQuerySuggestion(元素);
}
});
}));
};
如果(query.length>3){
API.stationRequest(查询、回调);
}
}
我或多或少地从windows WinJS站点复制了这个示例,但是。。。它在$(“#response”)
-元素中很好地显示了responsetext,但我没有得到任何框或列表
失败是什么
static stationRequest(event: CustomEvent) {
var query = <string>event.detail.queryText;
var suggestionCollection = event.detail.searchSuggestionCollection;
var callback = function (response) {
event.detail.setPromise(WinJS.Promise.then(null, function () {
var _locations: Array<Object> = JSON.parse(response.responseText).LocationList.StopLocation;
$("#response").text(JSON.stringify(_locations));
_locations.forEach(function (obj: ILocation, index, _loc) {
suggestionCollection.appendQuerySuggestion(obj.name);
});
event.detail.linguisticDetails.queryTextAlternatives.forEach(
function (element, index, array) {
if (element.substr(0, query.length).toLocaleLowerCase() === query) {
suggestionCollection.appendQuerySuggestion(element);
}
});
}));
};
if (query.length > 3) {
API.stationRequest(query, callback);
}
}