我在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 );
答案 0 :(得分:0)
看起来新版本的jquery不支持.browser
我将此添加到我的应用程序jquery.mb.browser.js
您可以在以下位置找到它:
https://github.com/pupunzi/jquery.mb.browser/archive/master.zip