2013-07-16 19 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