I am using the SAPUI5 control GenericTile
and added both headerImage
and click
event. When this icon is clicked, the event handler of the tile is triggered first so that I am not able to react on the icon click itself (which should perform another action of course).
var oGenericTile = new sap.suite.uimons.GenericTile({
frameType: "TwoByOne",
header: "My HEader",
headerImage: "sap-icon://settings",
tileContent: oTileContent
});
oGenericTile._oImage.attachPress(function(oEvent) {
sap.m.MessageToast.show("Icon has been pressed");
oEvent.cancelBubble();
oEvent.preventDefault();
});
oGenericTile.attachPress(function() {
sap.m.MessageToast.show("I am always triggered first!!! :-(");
});`
Any idea how I can avoid this?
I am using the SAPUI5 control GenericTile
and added both headerImage
and click
event. When this icon is clicked, the event handler of the tile is triggered first so that I am not able to react on the icon click itself (which should perform another action of course).
var oGenericTile = new sap.suite.ui.mons.GenericTile({
frameType: "TwoByOne",
header: "My HEader",
headerImage: "sap-icon://settings",
tileContent: oTileContent
});
oGenericTile._oImage.attachPress(function(oEvent) {
sap.m.MessageToast.show("Icon has been pressed");
oEvent.cancelBubble();
oEvent.preventDefault();
});
oGenericTile.attachPress(function() {
sap.m.MessageToast.show("I am always triggered first!!! :-(");
});`
Any idea how I can avoid this?
Share Improve this question edited Dec 17, 2021 at 21:43 Brian Tompsett - 汤莱恩 5,89372 gold badges61 silver badges133 bronze badges asked Jan 28, 2015 at 8:38 AntonSackAntonSack 1,0472 gold badges27 silver badges50 bronze badges 1-
1
You need to extend
sap.suite.mons.GenericTile
with your own control, i.e.my.GenericTile
and overridemy.GenericTile.prototype.onclick/ontapstart
method. – Nikolay Nadorichev Commented Jan 28, 2015 at 10:46
1 Answer
Reset to default 1you could e.g. also cancel the event on the tile manually in order to avoid this behavior... you'd just need to track whether the icon has been pressed, see a simplified example on JSBin: http://jsbin./daqifomoge/3/edit
Extending existing controls and overriding methods always bears the potential to break things when the original control gets an update from the developers...
Maybe there's a more elegant way to do it, though.
Best, Christiane
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745550806a4632569.html
评论列表(0条)