你可以在Dojo wijit模板中定义工具提示吗? [英] Can you define tooltips in Dojo wijit template?

查看:180
本文介绍了你可以在Dojo wijit模板中定义工具提示吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在wijit模板中定义时,我一直试图获得一个Dojo(1.6) dijit.Tooltip

I've been trying to get a Dojo (1.6) dijit.Tooltip to work when defined in a wijit template.

所以,如果我有wijit模板,包括以下内容:

So, if I have wijit template that includes the following:

<a data-dojo-attach-point="tooltipMe" href="" onclick="return false;">
  Show a Tooltip
</a>
<div data-dojo-type="dijit.Tooltip" data-dojo-props="connectId:'tooltipMe'">
  Got to love hovering over links. Sometimes you a get a free tooltip
</div>

当然,我可以看到链接,但是当我悬停时,没有任何反应。围绕新闻组进行侦察,似乎在wijit模板中定义工具提示可能会出现问题,但Dojo文档中没有提及。

I can see the link of course, but nothing happens when I hover. Scouting round the newsgroups it seems there might be a problem with defining tooltips in wijit templates, but it's not mentioned in the Dojo docs.

是否可以内联定义工具提示这个?或者我只是做错了,似乎是明显的地方。

Is it possible to define tooltips inline like this? Or am I just doing something wrong, it seems like the obvious place to do it.

如果没有,是否有一个接受的方法来创建和链接工具提示到DOM节点定义在wijit模板中?

If not, is there an accepted approach for creating and linking tooltips to DOM nodes defined in wijit templates?

推荐答案

工具提示connectId属性必须是DOM节点的ID。 data-dojo-attach-point不是一个id,它只是在实例化的窗口小部件中创建一个引用。

Tooltips connectId property has to be the id of a DOM node. data-dojo-attach-point is not an id, it just creates a reference in the instantiated widget.

所以在你的情况下,你需要为a -ode并在connectId中使用相同的id。为了避免在创建widget的多个实例时发生id冲突,您可以使用$ {id}变量替换,以确保所有id都是唯一的:

So in your case you need to assign an id to the a-node and use the same id in connectId. To avoid id clashes when creating multiple instances of your widget you can use the ${id} variable substitution to ensure that all ids are unique:

您的代码应该类似于这个:

Your code should look something like this:

<a id="${id}_link" data-dojo-attach-point="tooltipMe" href="" onclick="return false;">
  Show a Tooltip
</a>
<div data-dojo-type="dijit.Tooltip" data-dojo-props="connectId:'${id}_link'">
  Got to love hovering over links. Sometimes you a get a free tooltip
</div>

这篇关于你可以在Dojo wijit模板中定义工具提示吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆