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

问题描述 投票:0回答:3

我遇到的错误是:

"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>
javascript jquery datatables
3个回答
10
投票

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


0
投票

就我而言,td 的数量与 th 的数量也不匹配。


-1
投票

就我而言,错误与

td
的数量与
th
的数量不匹配有关。

© www.soinside.com 2019 - 2024. All rights reserved.