我正在开发Cordova混合应用程序,当前在Windows 8.1上使用Sencha Touch 2遇到问题。我在列表项上有一些div,其中包含一些子元素。我定义了一个监听器。这在Android和IOS上正常运行,但是在带有Internet Explorer的Win8.1上不起作用。我总是得到上面说谎的listitem元素,而不是单击的div容器。
这是简化的示例:
View :
Ext.define( 'App.view.MyDataView', {
xtype: 'mydataview',
extend: Ext.dataview.List ,
config: {
inline: false,
title: "myTitle",
scrollToTopOnRefresh: false,
cls: 'MyDataView',
itemCls: 'MyDataViewItem',
pressedCls: 'MyDataViewItemPressed',
grouped: true,
listeners: {
tap: {
element: 'element',
//delegate: '.something',
fn: function (e)
{
console.log(e.target.className)
}
}
},
deferEmptyText: false,
infinite: true,
variableHeights: true,
itemTpl: new Ext.XTemplate(
[
'<div class="red" style="background-color:red;width:50%">',
'red',
'<div class="black" style="background-color:black;width:80%">',
'<div class="blue" style="background-color:blue;width:30%">blue</div>',
'black</div>',
'</div>'
].join( '' ),
{
compiled: true,
getInteractable: function() {},
//some member functions here...
}
)
}
});
点击监听器上的e.target总是给我以下信息:
<div class="x-unsized x-list-item WorkingHoursDataViewItem x-has-height x-list-item-tpl" id="ext-simplelistitem-85" style="height: 42px !important; min-height: 42px !important; transform: translate3d(0px, 264px, 0px);">
<div class="x-unsized x-list-disclosure x-item-hidden" id="ext-component-233" style="display: none !important;"></div>
<div class="x-innerhtml" id="ext-element-815">
<div class="red" style="width: 50%; background-color: red;">
red
<div class="black" style="width: 80%; background-color:black;">
<div class="blue" style="width: 30%; background-color:blue;">
blue
</div>
</div>
black
</div>
</div>
</div>
</div>
</div>
</div>
</div>
我在事件(例如目标)中浏览了很多,但没有引用单击的div容器:/
提前致谢!
// edit:简化示例
//它与grouped:true->有关,如果我对此进行注释,则一切正常
最佳答案
修复了它-如果设置为grouped:true,则会在IE上导致此意外结果。
解决方法:显示 View 后:list.updateGrouped()