0x800a138f JavaScript runtime error: Unable to get property 'asSorting' of undefined or null reference 错误原因以及解决办法

使用Jquery Datatables的时候也许会碰到这样的错误提示,当我们仔细的查找代码,发现引用的js文件,css文件均引用了,就是找不到他的问题所在。

这是从我们引用的js文件内部报的错。

这个错误的原因:我们写的jquery datatables 没有严格的按照格式来写,大家往往是没有加入<thead></thead>,而是直接添加标题行,所以就没有标题行了,datatables 就会报错。

下面是比较正规的写法,body去除了,可以自己补上。

 1  <table class="gridtable">
 2         <thead>
 3             <tr>
 4                 <th>
 5                     Order ID
 6                 </th>
 7                 <th>
 8                     Total
 9                 </th>
10                 <th>
11                     Payment Applied Date
12                 </th>
13                 <th>
14                     Shipping Amount
15                 </th>
16                 <th>
17                     Shipped Date
18                 </th>
19                 <th>
20                     Shipping Method
21                 </th>
22                 <th>
23                     Shipped Carrier
24                 </th>
25                 <th>
26                     Tracking Number
27                 </th>
28                 <th>
29                     Status
30                 </th>
31             </tr>
32         </thead>
33 //此处省略<tbody>内容
34  </table>
原文地址:https://www.cnblogs.com/zjf1987/p/asSorting.html