admin管理员组文章数量:1334133
I need to retrieve some data attached to a standardListItem
when it is dragged. I am handling the drag with jQuery-UI draggable. I did the following:
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");
});
but the data retrieve only works when the StandardListItem
is clicked, I doesn't work when the element is dragged. So, the idea is to attach the data retrieve upon mouseenter
, how to attach an event listener the mouseenter
event.
I need to retrieve some data attached to a standardListItem
when it is dragged. I am handling the drag with jQuery-UI draggable. I did the following:
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");
});
but the data retrieve only works when the StandardListItem
is clicked, I doesn't work when the element is dragged. So, the idea is to attach the data retrieve upon mouseenter
, how to attach an event listener the mouseenter
event.
2 Answers
Reset to default 3You can attach browser event to any of the controls as given below.
oItemTemplate.attachBrowserEvent("mouseenter", function(oEvent) {
//get your model and do whatever you want:
oModel = sap.ui.getCore().getModel();
});
there is a function called attachBrowserEvent available on every object inheriting from sap.ui.core.Control: https://openui5.hana.ondemand./#docs/api/symbols/sap.ui.core.Control.html#attachBrowserEvent
Using that function you can basically bind to any native event the browser provides.
BR Chris
本文标签: javascriptHow to attach a mouseenter event listener to sapmStandardListItemStack Overflow
版权声明:本文标题:javascript - How to attach a mouseenter event listener to sap.m.StandardListItem? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742276439a2445282.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论