2013-03-17 89 views
0

我在Rails應用程序中使用gem'jquery-datatables-rails'。我也在使用ColViz工具。Rails datatables colviz獲取無法讀取屬性'msie'

但是,當我使用ColViz我得到在瀏覽器控制檯這個錯誤:

Uncaught TypeError: Cannot read property 'msie' of undefined 

這是我的咖啡腳本:

$(".dataTable").dataTable 
    bStateSave: true 
    fnStateSave: (oSettings, oData) -> 
    localStorage.setItem "DataTables_" + window.location.pathname, JSON.stringify(oData) 

    fnStateLoad: (oSettings) -> 
    JSON.parse localStorage.getItem("DataTables_" + window.location.pathname) 

sDom: "CT<\"clear\">lfrtip" 
oColVis: 
    buttonText: "Show/Hide" 
    aiExclude: [0] 
    bRestore: true 
    sAlign: "left" 

oTableTools: 
    aButtons: [ 
    sExtends: "xls" 
    sButtonText: "Excel" 
    mColumns: "visible" 
    , 
    sExtends: "pdf" 
    sPdfOrientation: "landscape" 
    sPdfMessage: "Endeavor" 
    mColumns: "visible" 
    ] 

UDPATE1

這是我在哪裏出現錯誤:

/* This results in a very small delay for the end user but it allows the animation to be 
    * much smoother. If you don't want the animation, then the setTimeout can be removed 
    */ 
    setTimeout(function() { 
     $(nHidden).animate({"opacity": 1}, that.s.iOverlayFade); 
     $(nBackground).animate({"opacity": 0.1}, that.s.iOverlayFade, 'linear', function() { 
      /* In IE6 if you set the checked attribute of a hidden checkbox, then this is not visually 
      * reflected. As such, we need to do it here, once it is visible. Unbelievable. 
      */ 
      if (jQuery.browser.msie && jQuery.browser.version == "6.0") 
Uncaught TypeError: Cannot read property 'msie' of undefined 
      { 
       that._fnDrawCallback(); 
      } 
     }); 
    }, 10); 

回答

0

它看起來像jQuery的新版本不支持.browser

我將此添加到我的應用程序jquery.mb.browser.js

您可以在這個位置找到它:

https://github.com/pupunzi/jquery.mb.browser/archive/master.zip