如何将 mouseenter 事件侦听器附加到 sap.m.StandardListItem
How to attach a mouseenter event listener to sap.m.StandardListItem?
我需要在拖动standardListItem
时检索一些附加到的数据。我正在使用可拖动的jQuery-UI处理拖动。我做了以下工作:
var oItemTemplate = new sap.m.StandardListItem();
oItemTemplate .bindProperty("title", "ListModel>oLabel");
oItemTemplate .data("usefulListData","ListModel>EdmType");
oItemTemplate .addStyleClass("Draggable");
oItemTemplate .setType(sap.m.ListType.Active);
oItemTemplate .attachPress(function( ){
console.log(this.data("usefulListData"));
console.log("item pressed");
});
但是数据检索仅在单击StandardListItem
时有效,在拖动元素时不起作用。因此,这个想法是在mouseenter
附加检索的数据,如何附加事件侦听器mouseenter
事件。
您可以将浏览器事件附加到任何控件,如下所示。
oItemTemplate.attachBrowserEvent("mouseenter", function(oEvent) {
//get your model and do whatever you want:
oModel = sap.ui.getCore().getModel();
});
有
一个名为 attachBrowserEvent 的函数可用于从 sap.ui.core.Control 继承的每个对象:https://openui5.hana.ondemand.com/#docs/api/symbols/sap.ui.core.Control.html#attachBrowserEvent
使用该函数,您基本上可以绑定到浏览器提供的任何本机事件。
BR克里斯
相关文章:
- 如何在sap.m.Image元素上创建可点击区域
- 在控制器中创建StandardListItem并在赢得的项目上按下事件'不要开火
- 可以将模型传播到组件,但不能传播到sap.ui.jsfragment
- 打开 UI5 sap-ui-core.js无法加载资源
- SAP UI5-无法从表中删除所选行
- 在SAPUI5项目中使用sap.ui.ux3.Shell时,无法在iphone上滚动
- sap.m.输入浮点类型
- sap.m.按钮文本格式化程序
- 使用 sap.ui.table.Table 就像 PowerPivot 表一样
- sap.m.Table 中是否有多个标头,例如 sap.ui.table.Table
- SAP Netweaver 上的 IE 10 跨源请求
- 如何在 sap ui5 的文本字段中设置自动完成或自动建议,例如 sap.m.Input
- 在“sap.ui.model.SimpleType.extend”中设置文本字段值状态
- 如何从 SAP UI 中的表中获取数据
- SAPUI5 使整行可点击 sap.m.Panel
- 如何将 mouseenter 事件侦听器附加到 sap.m.StandardListItem
- sap.m.CustomListItem 上的事件“按”不起作用
- SAP openui5:将自定义数据附加到表列模板时出错
- 聚合”;项目”;在元素sap.m.StandardListItem#subcatId中不存在
- 如何访问sap.m.List中的StandardListItem