简体   繁体   中英

sencha touch HTMLDivElement in on click function

Help me to get the particular div id result from 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);
         });

In .on function I want to get the patientId for which list I click for. How to get this? Please help me.

In event is coming as object HTMLDivElement , event.innerHTML alert I am getting the result

<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>

From this how can I get that PAT-3407 ? Please help me.

If your store is correctly setup, you only have to do:

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

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

}):

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM