DataTables:未捕获的TypeError:无法读取未定义的属性“默认值” [英] DataTables: Uncaught TypeError: Cannot read property 'defaults' of undefined

查看:196
本文介绍了DataTables:未捕获的TypeError:无法读取未定义的属性“默认值”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用DataTables的 Bootstrap集成时,我在控制台中看到以下错误:

When using the Bootstrap integration for DataTables, I see the following error in the console:

Uncaught TypeError: Cannot read property 'defaults' of undefined (dataTables.bootstrap.js:20)

这会导致分页控件没有样式。

This causes the pagination controls to not have styles on them.

我可以看到在工厂初始化时,需要运行以下代码:

I can see that in the factory initialization, the following code needs to run:

factory( jQuery, jQuery.fn.dataTable );

但是, jQuery.fn.dataTable 是返回 undefined

推荐答案

问题在于 dataTable 。

确保您正在加载 .js 文件的顺序正确:

Ensure that you are loading the .js files in the correct order:

<script src="/Scripts/jquery.dataTables.js"></script>
<script src="/Scripts/dataTables.bootstrap.js"></script>

这篇关于DataTables:未捕获的TypeError:无法读取未定义的属性“默认值”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆