我在 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 );