Just like in traditional Lotus Notes client
development when it comes to XPages there is more then one way of doing
the exact same thing. Earlier today Matt White posted
on the subject of using Dojo Tooltips
in an XPage application. In an IM to Matt I mentioned that I was doing
something similar using using a custom control and in the comments on Matt’s
blog entry Tim Tripcony mentioned that he
uses passthru HTML to add rich content to the tooltips. So here we have
three different approaches to doing the exact same thing.
Looking at Tim’s idea of passthru HTML
I re-examined my custom control method and realized that I could also make
it so that I can put rich content into my tooltips. Here’s is my new custom
control. It has a single property called ‘connectID’ which I am accessing
using the compositeData global object. Inside the DIV I have added an ‘Editable
Area’ control, otherwise known as a facet.
In the XPage where I want the tooltip
to appear I drag in the custom control and in it’s properties I can see
my connectID property. I set that to be computed to getClientId("nameofControlToAttachTo"),
In this case it will be the label control with the ID of TestToolTip. Don’t
forget that tit is case sensitive.
In design mode you’ll see your new ToolTip
The green dot is where you can drag
in the rich content, it could be an image, a computed field, a label, you
can even drag a panel into the editable area and add other controls to
that panel. In the example below I dragged in a panel and then added an
image and button into the panel.
Now when you look at your page you’ll
see your tooltip with it’s rich content. Obviously some content ( like
buttons ) are useless in a tooltip because you can’t click on the content
of the tooltip in this context but the ability to add any control into
the facet can open some doors for other ideas. Imagine using a repeat control
in the tooltip to show the titles of document authors, the repeat handling
the case where there is more then one author.
The other advantage of using the tooltip
as a custom control is that you can add as many as you need to a single
xpage. You just need to set the connectID property and drag whatever contents
you want into the editable area and your done. No need to remember the
syntax for the dojo control.
Good post, thanks!
LikeLike
Hi Declan,I’m just loving your Xpage blog, Declan,but I’m struggling with your Example. I have tied but get the Error “Unknown property this.connectID. It is not defined on tag xc:cc_ToolTip. testtooltip.xsp testlogin.nsf/XPages line 10 com.ibm.designer.domino.ide.resources.designerproblem” I have checked my code but can’t find any Error’s.
LikeLike
Lovin your XPages series Declan { Link } However, the link to your XPages Phonebook sample at OpenNTF is dead:{ Link }Are you arranging to have the resource files hosted elsewhere?
LikeLike
Hi Declan, Thanks for a very usefull exapmle.. Need your help I am stuck here .. not able to find out “connectID” property.
LikeLike
Am afraid I couldn’t get it to work either. No errors visible but no tooltip either.
LikeLike