帮助我从 HTMLDivElement
获取特定的 div id
结果
wplStore.load();
var itemTpl = new Ext.XTemplate('<div class="wpllist">'+
'<div><div class="wpl_txt_line1">{patientInfo} </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) </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/