我的項目包含來自NuGet的JQuery.DataTable插件的JS文件。我的項目中也引用了jQuery 2.1.3。jQuery.fn.dataTable未定義
雖然我jQuery的使用<%:Scripts.Render("~/bundles/jquery") %>
加載,參考的jQuery UI +數據表(它獲取的成功<script>
標籤翻譯,我得到噸的錯誤在我的Firebug的控制檯
TypeError: jQuery.fn.dataTable is undefined
else if (jQuery && !jQuery.fn.dataTable.AutoFill) {
dataTab...Fill.js (linea 848, col 20)
TypeError: $.fn.dataTable is undefined
$.extend(true, $.fn.dataTable.defaults, {
dataTab...trap.js (riga 2)
TypeError: $.fn.dataTableExt is undefined
$.fn.dataTableExt.oApi.fnColReorder = function (oSettings, iFrom, iTo)
dataTab...rder.js (riga 110)
TypeError: jQuery.fn.dataTable is undefined
else if (jQuery && !jQuery.fn.dataTable.ColVis) {
dataTab...lVis.js (linea 1100, col 20)
TypeError: jQuery.fn.dataTable is undefined
else if (jQuery && !jQuery.fn.dataTable.FixedColumns) {
dataTab...umns.js (linea 1392, col 20)
TypeError: jQuery.fn.dataTable is undefined
else if (jQuery && !jQuery.fn.dataTable.FixedHeader) {
dataTab...ader.js (linea 1021, col 20)
TypeError: $.fn.dataTable is undefined
$.extend(true, $.fn.dataTable.defaults, {
dataTab...tion.js (riga 2)
TypeError: DataTable is undefined
$.extend(true, DataTable.defaults, {
dataTab...ryui.js (riga 9)
TypeError: jQuery.fn.dataTable is undefined
else if (jQuery && !jQuery.fn.dataTable.KeyTable) {
dataTab...able.js (linea 1169, col 20)
TypeError: jQuery.fn.dataTable is undefined
else if (jQuery && !jQuery.fn.dataTable.Responsive) {
dataTab...sive.js (linea 794, col 20)
TypeError: jQuery.fn.dataTable is undefined
else if (jQuery && !jQuery.fn.dataTable.Scroller) {
dataTab...ller.js (linea 1255, col 20)
TypeError: jQuery.fn.dataTable is undefined
else if (jQuery && !jQuery.fn.dataTable.TableTools) {
dataTab...ools.js (linea 3208, col 20)
我已經定義了數據表與
捆綁bundles.Add(new ScriptBundle("~/bundles/jquery-ui").Include("~/Scripts/jquery-ui-{version}.js").Include("~/Scripts/jquery.ui.datepicker.js")
.IncludeDirectory("~/Scripts/DataTables-1.10.4", "*.js", false));
這被翻譯成至少
<script src="/Scripts/DataTables-1.10.4/dataTables.autoFill.js">
<script src="/Scripts/DataTables-1.10.4/dataTables.bootstrap.js">
<script src="/Scripts/DataTables-1.10.4/dataTables.colReorder.js">
<script src="/Scripts/DataTables-1.10.4/dataTables.colVis.js">
<script src="/Scripts/DataTables-1.10.4/dataTables.fixedColumns.js">
<script src="/Scripts/DataTables-1.10.4/dataTables.fixedHeader.js">
<script src="/Scripts/DataTables-1.10.4/dataTables.foundation.js">
<script src="/Scripts/DataTables-1.10.4/dataTables.jqueryui.js">
<script src="/Scripts/DataTables-1.10.4/dataTables.keyTable.js">
<script src="/Scripts/DataTables-1.10.4/dataTables.responsive.js">
<script src="/Scripts/DataTables-1.10.4/dataTables.scroller.js">
<script src="/Scripts/DataTables-1.10.4/dataTables.tableTools.js">
<script src="/Scripts/DataTables-1.10.4/jquery.dataTables.js">
Superfish也一樣,但我們一次解決一件事。我該如何解決這個問題?
'jquery.dataTables.js'首先需要加載,'autofill'之前,' bootstrap'等文件。你需要實現'IBundleOrderer',或者手動包含這些文件。更多的信息在這裏:http://stackoverflow.com/questions/11979718/how-can-i-specify-an-explicit-scriptbundle-include-order – 2015-02-09 13:32:07