数据表 - 未捕获的类型错误:ba 未定义

Ada*_*tus 3 javascript jquery datatables

我的错误是:

"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"
Run Code Online (Sandbox Code Playgroud)

没有显示其他错误。我将 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>
Run Code Online (Sandbox Code Playgroud)

Ada*_*tus 9

解决方案是以数据表喜欢的方式构建表。他们的主页上没有任何关于此的内容,他们告诉您这只是导入 2 个脚本文件的情况。但是它们要求您使用 thead 和 tbody 元素。没有这个,它就会失败,错误对诊断根本没有帮助!

  • 很高兴您解决了这个问题 - 是的,对您有帮助的文档不在主页上 - 您必须挖掘一下。但是,作为参考,[这里是](https://datatables.net/manual/installation)。 (4认同)