我有这段代码:
var search = Titanium.UI.createSearchBar();
var myTemplate = {
properties: {
accessoryType: Ti.UI.LIST_ACCESSORY_TYPE_DISCLOSURE,
},
childTemplates: [
{
type: 'Ti.UI.Label',
bindId: 'destinazione',
properties: {
left: '24%'
}
},
]
};
var listView = Ti.UI.createListView({
templates: { 'template': myTemplate },
defaultItemTemplate: 'template',
searchView: search
});
恢复要使用onload输入的数据
xhrPart.onload = function() {
partenzeJSON = JSON.parse(this.responseText);
for (i in partenzeJSON){
var flightSection = Ti.UI.createListSection();
var flightDataSet = [];
flightDataSet = [{
destinazione: {text: partenzeJSON[i].destinazione, searchableText: partenzeJSON[i].destinazione},
}];
flightSection.setItems(flightDataSet);
sections.push(flightSection);
}
listViewPartenze.setSections(sections);
};
因为研究不起作用? 不查找listview中的数据输入
感谢!!!
答案 0 :(得分:2)
searchableText
必须进入对象的属性,而不是进入label
它应该是这样的:
flightDataSet = [{
destinazione: {text: partenzeJSON[i].destinazione},
properties: {searchableText: partenzeJSON[i].destinazione}
}];