jQuery Datatables large data set Uncaught TypeError: Cannot read property 'mData' of undefined

点点圈 提交于 2019-12-02 05:11:34

CAUSE

Number of items in array specified by columns option should match number of <td> elements. You have 12 elements in columns array and 13 <td> elements.

From the manual:

Note that if you use columns to define your columns, you must have an entry in the array for every single column that you have in your table (these can be null if you don't which to specify any options).

SOLUTION

Add extra object to columns array to match number of columns in the HTML.

Alternatively you can replace columns with columnDefs entirely for readability.

"columnDefs": [{
      "orderable": false,
      "searchable": false,
      "targets": [0]
   }, {
      "orderable": false,
      "targets": [2, 3, 11, 12]
   }
],

LINKS

See jQuery DataTables: Common JavaScript console errors for more information on this and other common console errors.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!