2013-07-16 80 views
0

工作我使用的是: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

模样DOM不再发现/或文件莫名其妙删除。所以我只能猜测 是因为Javascript使用引用传递,内容对象已经多次移动,直到它以某种方式被移除。

你可以试试复制对象吗?

尝试改变:

var legend = $('#status_legend'); 

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

谢谢!那完美的工作。 – jbobbins