on 2023 Nov 24 12:01 PM
Hello all,
I have a custom control that extends from sap.m.StandardTile and I want to add an enabled property to it, so I can prevent the "press" event from firing if enabled = false.
My trouble now is that in this example of adding a custom event to a custom control that extends the default Button: Documentation - Demo Kit - SAPUI5 SDK (ondemand.com) .
Where does the function this.fireHover() come from? I checked the api reference for Button and there is no such thing as .fireHover() in it. So is this function that is the implemented in the custom control and is just missing in this example or am I missing something?
In my use case, I would simply think that I can override the press method like so:
and define the new enabled property like so:
However the press event still fires, even if I set the new enabled propert to enabled = "false" in the XML.
Any help would be greatly appreciated.
Cheers!
Hi, I didn't test this, but you can try to overwrite firePress like this:
firePress: function () {
if (this.getEnabled()) {
StandardTile.prototype.firePress.call(this);
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What is the reason for extending sap.m.StandardTile in the first place? The StandardTile is deprecated since UI5 1.50. Consider using sap.m.GenericTile instead which supports the "Disabled" state among others out of the box. If the GenericTile is disabled, no press event will be fired.
<GenericTile xmlns="sap.m" state="Disabled" pressEnabled="false">
<!-- ... -->
Sample: https://ui5.sap.com/#/entity/sap.m.GenericTile/sample/sap.m.sample.GenericTileStates/code
API Reference: https://ui5.sap.com/#/api/sap.m.GenericTile
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
70 | |
10 | |
10 | |
7 | |
6 | |
6 | |
6 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.