2017-03-18 113 views
0

工作,我有这样的代码:钛Appcelerator的搜索不与搜索栏

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); 
    }; 

进入,因为研究不工作? 不寻找列表视图中的数据输入

谢谢!!!

回答

2

searchableText已进入对象的属性,而不是为label

它应该是这样的:

flightDataSet = [{ 
    destinazione: {text: partenzeJSON[i].destinazione}, 
    properties: {searchableText: partenzeJSON[i].destinazione} 
}];