Hi all,
I want to utilize the HTML title attribute in my UI5 Link element, but I can't seem to find any support for this. Is there a way to get UI5 to take advantage of the title attribute? To be clear, I mean this:
https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/title
As in:
<a href="..." title="Tooltip text">Display text</a>
Thanks for any help!
-Chris
Request clarification before answering.
Christopher,
woudl this help?
https://sapui5.netweaver.ondemand.com/sdk/explored.html#/entity/sap.m.Popover/samples
or this
also, this is not the title but maybe also helpful to add a custom data attribute as in HTML5 in case you need to add attributes to controls
as far as some of the controls, here is the sdk
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for your reply, Sergio!
Of course, I had already looked through the SDK and found nothing appropriate.
I had already looked into Popover. All I want is default hover text for a link, so Popover is overkill and too much work to implement.
QuickView seems to be even more overkill, since it appears to be fore business card style popups.
I have discovered how to do this via JS, however! Every element has a method called setTooltip() that will in most cases allow you to set the title attribute of the generated element if you pass it a string.
This works, but I really want to set it in my XML view instead of having to write code in my controller. I have found that you can embed an element called <tooltip/> inside the <Link/> element, but it does not allow me to put plain text inside. The only way I have been able to make this work in the XML view is to embed a RichTooltip inside the <tooltip/> element. This is also undesirable, since it does not use the title attribute.
Does anyone know how to set a string-only tooltip in an XML view?
Thanks again!
-Chris
OK, I found the answer!
As I mentioned in my previous post, every UI element that extends Element has getter and setter methods for tooltip and calling setTooltip() passing a string, sets the HTML title attribute on the resulting element in most cases. Well, tooltip is just an attribute on every element, so you can just reference it as an attribute of the XML element in the XML view like:
<Link href="..." tooltip="This is the HTML title attribute"/>
Yay!
-Chris
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.