Titanium appcelerator 搜索不适用于 SearchBar
Titanium appcelerator search does not work with SearchBar
我有这个代码:
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中的数据输入
谢谢!!!
searchableText
必须进入对象的属性而不是 label
它应该是这样的:
flightDataSet = [{
destinazione: {text: partenzeJSON[i].destinazione},
properties: {searchableText: partenzeJSON[i].destinazione}
}];
我有这个代码:
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中的数据输入
谢谢!!!
searchableText
必须进入对象的属性而不是 label
它应该是这样的:
flightDataSet = [{
destinazione: {text: partenzeJSON[i].destinazione},
properties: {searchableText: partenzeJSON[i].destinazione}
}];