帮助我从div id获取特定的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);
         });


.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吗?请帮我。

最佳答案

如果您的商店设置正确,则只需执行以下操作:

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

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

}):

关于javascript - 点击功能中的sencha touch HTMLDivElement,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/7709086/

10-09 15:01