2011-10-10 67 views
1

幫我從HTMLDivElement煎茶觸摸HTMLDivElement在點擊功能

wplStore.load(); 
var itemTpl = new Ext.XTemplate('<div class="wpllist">'+ 
       '<div><div class="wpl_txt_line1">{patientInfo}&nbsp;</div> <div class="wpl_txt_line1_right" style="float:right"></div></div>'+ 
       '<div style="clear:both"><div id="patientId" class="wpl_txt_line2_left">{patientId}</div> <div class="wpl_txt_line2_right">{checkInTime}</div></div>'+ 
       '</div>'); 

this.wplPatList = new Ext.List({ 
      id: 'wPatList', 
      store: wplStore, 
      itemTpl: itemTpl, 
      height: 370,    
      indexBar: false 
     }); 
     this.wplPatList.on('itemtap', function (view, item, event) { 
     alert(event.innerHTML + 'event'); 
      controller.showPatHisPanel(item); 
     }); 

獲得特定div id導致.on功能我想要得到的patientId爲我點擊該列表。如何得到這個?請幫幫我。

在事件即將爲對象HTMLDivElementevent.innerHTML警告我得到的結果

<div class="x-list-item-body"><div class="wpllist"><div><div class="wpl_txt_line1">Dinesh (Male, 9)&nbsp;</div> <div class="wpl_txt_line1_right" style="float:right"> </div></div><div style="clear:both"><div id="patientId" class="wpl_txt_line2_left">PAT-3407</div> <div class="wpl_txt_line2_right">Wed Sep 14 2011 06:07:00 GMT+0530 (IST)</div></div></div></div> 

從這個我怎麼可以得到PAT-3407?請幫幫我。

回答

0

如果你的店是正確的設置,你只需要做:

this.wplPatList.on('itemtap', function (view, item, event) { 

    var record = wplStore.getAt(item); 
    controller.showPatHisPanel(record.data.patientId); 

}): 
+0

謝謝!我得到了結果 – Shakthi

+0

不錯的一個!請將此答案標記爲解決方案。乾杯 – Luis