【发布时间】:2017-05-14 15:07:56
【问题描述】:
我用悬停事件处理扩展了 sap.ui.core.Icon:
sap.ui.define(function () {
"use strict";
return sap.ui.core.Icon.extend("abc.reuseController.HoverIcon", {
metadata: {
events: {
"hover" : {}
}
},
// the hover event handler, it is called when the Button is hovered - no event registration required
onmouseover : function(evt) {
this.fireHover();
},
// add nothing, just inherit the ButtonRenderer as is
renderer: {}
});
});
永远不会触发 onmouseover 事件。我也将此扩展用于 sap.m.Button 和 works。但我需要这个用于 sap.ui.core.Icon。
我也尝试了this jquery 示例,但它根本不起作用。
$("testIcon").hover(function(oEvent){alert("Button" + oEvent.getSource().getId());});
请问,您知道为什么不为 sap.ui.core.Icon 调用事件处理程序 onmouseover 吗?或者您能提出其他解决方案吗?
下面是我向 sap.suite.ui.commons.ChartContainer 添加图标的方式:
var oFilterIcon = new HoverIcon({
tooltip : "{i18n>filter}",
src : "sap-icon://filter",
hover : function(oEvent){alert("Button" + oEvent.getSource().getId());},
});
this.byId("idChartContainer").addCustomIcon(oFilterIcon);
【问题讨论】:
-
您的控件在您的代码示例中被命名为
abc.reuseController.HoverIcon,但您将sap.ui.core.HoverIcon添加到您的ChartContainer。错字? -
谢谢,我打错了,在stackoverflow中,在代码中是正确的。
标签: hover sapui5 jquery-hover