且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

jQuery DataTables:未捕获的TypeError:无法读取属性' mData'未定义

更新时间:2021-07-08 15:37:10

通常,出现此错误的原因有两个:

Usually this error occurs for two reasons:

  • 缺少表头.
  • 表主体中的td元素数与表头中的th元素数不同.
  • Missing table header.
  • Number of td elements in the table body differs from number of th elements in the table header.

但是您的HTML代码似乎具有正确的列数,请参见此示例.

However your HTML code seems to have correct number of columns, see this example.

请参见 jQuery数据表:常见的JavaScript控制台错误-TypeError:无法读取未定义的属性'mData',以获取更多信息.

See jQuery DataTables: Common JavaScript console errors - TypeError: Cannot read property ‘mData’ of undefined for more information.