javascript - 点击功能中的 sencha touch HTMLDivElement

标签 javascript html sencha-touch

帮助我从 HTMLDivElement 获取特定的 div id 结果

 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函数中,我想获取我点击的列表的patentId。如何得到这个?请帮助我。

如果事件作为对象 HTMLDivElement 出现,event.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/

相关文章:

javascript - 从 div 中检索文本并将其放入表单输入中

html - CSS 宽度和重叠

html - 为什么我要指定高度 : 0 even if I specified flex-basis: 0 in CSS3 flexbox?

android - sencha 包无法在 Release模式下运行 zipalign

javascript - 如何检查 x 是否是对象而不是字符串对象

javascript - 重新加载时,页面跳转到随机部分

javascript - 如何根据页面更改 Bootstrap 类列表组项目的事件状态

html - 为什么 Chrome 开发者工具会插入 HTML?

html - 将 Java Applet 添加到 Sencha Touch 2

json - 将Sencha Touch的JSON数据发送到ASP.NET MVC