Dynatree和qtip2 - 第一个子节点上没有(悬停)事件 [英] Dynatree and qtip2 -- No (hover) events on first subnode

查看:118
本文介绍了Dynatree和qtip2 - 第一个子节点上没有(悬停)事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我将鼠标悬停在我的Dynatree中的
a节点上时,我想显示一个自定义qtip。

I have a custom qtip that I want to show when you hover the mouse over a node in my Dynatree.

我遇到的问题是我似乎没有在父母的第一个孩子身上获得任何子节点悬停事件。

The problem I'm having is that I do not seem to be getting any subnode hover events on the first child of a parent.

我正在创建这样的孩子:

I'm creating children like this:

var tipKey = uuid();
var childNode = parent.addChild({
            title: field.Description,
            isFolder: false,
            icon: icon,
            key: tipKey,
            addClass: tipKey,
        });
        $("." + tipKey).qtip({
            content: {
                text: '   ',
                title: {
                    text: '   '
                }
            },
            style: {
                classes: 'ui-tooltip-shadow ui-tooltip-yellow'
            },
            events: {
                show: function (event, api) {
                    var node = $.ui.dynatree.getNode($(api.elements.target));
                    var field = _workingFieldList[node.data.key];
                    //code to set qtip content omitted.
                }
            }
        });

所有提示看起来都很好,除了每个父母的第一个孩子。这可能是一个错误,或者是一些我没有看到的奇怪问题。如果我为$('#tree a')添加处理程序.hover(),我会在每个mousein / out上获取事件;我尝试使用它来显示qtip,但这也不起作用。

All the tips appear just fine except the 1st child of every parent. This is either a bug, or, some strange issue I'm not seeing. If I add a handler for $('#tree a').hover(), I do get the events on every mousein/out; I tried to use that to show the qtip, but that did not work either.

推荐答案

Dynatree仅在扩展为节点时呈现节点第一次,所以你的代码可能过早绑定。
尝试绑定'onCreate'回调。

Dynatree renders nodes only when expanded for the first time, so your code may bind too early. Try to bind in the 'onCreate' callback instead.

这篇关于Dynatree和qtip2 - 第一个子节点上没有(悬停)事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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