0

我在 Rails 应用程序中使用 gem 'jquery-datatables-rails'。我也在使用 ColViz 工具。

但是,当我使用 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 );
4

1 回答 1

0

新版本的 jquery 好像不支持 .browser

我将此添加到我的应用 jquery.mb.browser.js

您可以在以下位置找到它:

https://github.com/pupunzi/jquery.mb.browser/archive/master.zip
于 2013-03-24T19:46:31.307 回答