2011-10-09 85 views
2

我在Sencha Touch中擁有一個正常列表。 現在我需要將該列表中的單個項目標記爲「披露」項目。Sencha Touch:在單個項目上披露

的功能應該是某事像這樣:

onItemDisclosure: function(record) { 
    if (record.data.type != "link") return false; //not a disclosure 
    return true; //disclosure item 
} 

這是可能實現?

+0

那麼有什麼問題呢? – ilija139

+0

這裏沒有問題。 – codeScriber

回答

2

試試這個:

new Ext.List({ 
    onItemDisclosure:true, 
    store:'Events', 
    itemTpl:'{date} {name}', 
    listeners:{ 
     afterrender:function(cmp){ 
      this.store.each(function(record,index,itemsCount){ 
       if(record.data.type != "link"){ 
        Ext.select('.x-list-disclosure',cmp.getNode(index)).remove(); 
       } 
      });       
     }, 
     itemtap:function(list,index,item){ 
      var record = this.store.getAt(index); 
      if(record.data.type == "link"){ 
       // do action 
      }    
     } 
    } 
}) 
+0

謝謝!這使得它完美:) –