0

我需要在standardListItem拖动时检索附加到 a 的一些数据。我正在使用可拖动的 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

4

2 回答 2

3

您可以将浏览器事件附加到任何控件,如下所示。

oItemTemplate.attachBrowserEvent("mouseenter", function(oEvent) {
    //get your model and do whatever you want:
    oModel = sap.ui.getCore().getModel();
});
于 2014-02-18T13:13:06.400 回答
2

从 sap.ui.core.Control 继承的每个对象都有一个名为 attachBrowserEvent 的函数: https ://openui5.hana.ondemand.com/#docs/api/symbols/sap.ui.core.Control.html#attachBrowserEvent

使用该功能,您基本上可以绑定到浏览器提供的任何本机事件。

克里斯

于 2014-01-23T22:24:54.227 回答