javascript - 数据表 - 未捕获的类型错误:ba 未定义
问题描述
我遇到的错误是:
"Uncaught TypeError: ba is undefined"
"https://cdn.datatables.net/v/dt/dt-1.10.22/b-1.6.5/b-print-1.6.5/r-2.2.6/datatables.min.js:119"
没有显示其他错误。我将 Jquery 放在列表的首位,并检查了所有路径是否正常。我还从数据表站点获得了我认为最合适的链接。
<!DOCTYPE html>
<html lang="en">
<head>
<title>Ajax Filter table</title>
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/dt/dt-1.10.22/b-1.6.5/b-print-1.6.5/r-2.2.6/datatables.min.css"/>
<script type="text/javascript" src="https://cdn.datatables.net/v/dt/dt-1.10.22/b-1.6.5/b-print-1.6.5/r-2.2.6/datatables.min.js"></script>
<script>
$(document).ready(function(){
$('#table').DataTable();
})
</script>
</head>
<body>
<div class="container">
<table class="table table-striped" id="table">
<tr>
<th>one</th>
<th>two</th>
<th>three</th>
<th>four</th>
</tr>
<tr>
<td>one</td>
<td>two</td>
<td>three</td>
<td>four</td>
</tr>
</table>
</div>
</body>
</html>
解决方案
解决方案是以数据表喜欢的方式构建表。他们的主页上没有任何内容,他们告诉您这只是导入 2 个脚本文件的情况。但它们要求您使用 thead 和 tbody 元素。没有这个,它只会翻倒,错误对诊断毫无帮助!
推荐阅读
- scala - 了解 Stream Scala 交错转换行为
- php - 当我添加另一个 php 站点时,该站点被重定向到另一个 php 站点,我没有编写重定向 .conf 文件。发生了什么事?
- linux - “权限被拒绝”时如何显示图像
- spring - java.lang.IllegalStateException:当前没有用户登录
- android - 使用 gradle 构建时将环境变量传递给 cmake
- appium - 如何使用 appium 将所有 recyclerView 项放入 ArrayList
- sql - hadoop hive 使用 row_number()
- python - 使用 Numpy 查找数组中的行组合,使得每列的总和为相同的值
- python - Python中同时出现两个数字
- msbuild - 在针对 netcoreapp2.1 的 MSBuild 任务中使用 SqlClient