jQuery UI工具提示在jqGrid中停止工作

时间:2013-07-16 00:20:37

标签: jquery jquery-ui jqgrid

我正在使用:

jqGrid 4.5.2.  
jQueryUI 1.10.3
jQuery 1.9.1

在我的jqGrid设置中,我这样做:

gridComplete: setupJobStatusLegend

调用:

function setupJobStatusLegend() {
    $(document).tooltip({
        items: '.has_status_legend',
        content: function(){
            var legend = $('#status_legend');
            legend.css('zIndex', 9999);
            console.log(legend.html());
            return legend;
        }
    });
}

当我第一次将鼠标悬停在行上时,它很有效。但是当我点击一行或离开网格的范围时,工具提示永远不会再出现。

关于它为何停止展示的任何想法?当它工作时,它会显示控制台日志行:

<img src="/static/img/circle_15_green.png"> Active<br>
<img src="/static/img/circle_15_yellow.png"> Hold<br>
<img src="/static/img/circle_15_orange.png"> Closed<br>
<img src="/static/img/circle_15_red.png"> Deleted<br>

当它不起作用时,它会显示控制台日志行的undefined

status_legend的HTML是:

<div id="status_legend" style="position: absolute; zoom: .75; opacity: 1; background-color: #ffffff;">
    <img src="/static/img/circle_15_green.png"> Active<br/>
    <img src="/static/img/circle_15_yellow.png"> Hold<br/>
    <img src="/static/img/circle_15_orange.png"> Closed<br/>
    <img src="/static/img/circle_15_red.png"> Deleted<br/>
</div>

1 个答案:

答案 0 :(得分:1)

看起来不再以某种方式找到/或从文档中删除dom。所以我只能猜到这一点 因为Javascript使用传递引用,内容对象已经移动了很多次,直到它被删除。

你可以尝试复制对象吗?

尝试改变:

var legend = $('#status_legend');

var legend = $('#status_legend').clone();