第一次使用datatables,在不经意间遇到了这个问题:

Uncaught TypeError: Cannot read property 'mData' of undefined

开始以为是与jquery的版本有关,使用了官网提供的版本仍然有这个问题。

后来查到相关话题,原来datatables对table的结构比较严格,必须要有

<thead>
</thead> 

添加后问题解决。

 

发表评论