在使用DataTable时,遇到以下报错:

Uncaught TypeError: Cannot set property 'nTf' of undefined
... ...

初步排查后发现是<thead><tr><td>数量与实际不同,可能是以下几个原因导致:

1.<tfoot><tr>下的<td><head>下的<th>数量对应不上,thead中只有4个th,tfoot中的td却colspan="6",导致报错

 

2.渲染DataTable时,columns和columnDefs的数量对应不上导致报错:

解决方案:

  • 仔细排查table的th与td是否一致
  • 查看渲染DataTable时,配置的columns和columnDefs与table单元格数量是否一致

JS报错:Uncaught TypeError: Cannot set property ‘nTf‘ of undefined的更多相关文章

  1. js 报错 Uncaught TypeError: Cannot read property 'trim' of undefined

    jquery Uncaught TypeError: Cannot read property 'trim' of undefined 报错原因及解决方案 $.trim() 函数用于去除字符串两端的空 ...

  2. Vue 组件封装发布到npm 报错 Uncaught TypeError: Cannot read property 'toLowerCase' of undefined

    Uncaught TypeError: Cannot read property 'toLowerCase' of undefined 原因是 没有导出 export default { name:& ...

  3. easyui Datagrid查询报错Uncaught TypeError:Cannot read property 'length' of undefined

    1.问题描述 easyui中datagrid执行loadData方法出现如下异常:Cannot read property 'length' of undefined 2.一开始怀疑是js或者页面的问 ...

  4. 报错: Uncaught TypeError: Cannot read property 'prototype' of undefined(Day_43)

    报错原因 引入的js顺序错误,elementUI需要依赖于Vue,调整顺序即可. 调整后

  5. Datatable报错Uncaught TypeError: Cannot read property 'cell' of undefined

    使用Datatables时,报出错误 仔细想想,是因为我在columns里加入了id,并设置visible:false 但是却没在下面的HTML部分多加一个 th 虽然我觉得因为id是隐藏的,不用加上 ...

  6. vue项目使用echarts按需引入实现地图动态显示效果时,报错:TypeError: Cannot read property 'dataToPoint' of undefined

    vue项目使用echarts按需引入实现地图动态显示效果时,报错:TypeError: Cannot read property 'dataToPoint' of undefined 借鉴了该大神的文 ...

  7. 前台报错:Uncaught TypeError: Cannot read property '0' of null

    错误现象: var div1=mycss[0].style.backgroundColor;  //这一行提示360和chrome提示:Uncaught TypeError: Cannot read  ...

  8. vue报错 Uncaught TypeError: Cannot read property ‘children ’ of null

    Uncaught TypeError: Cannot read property ‘children ’ of null ratings未渲染完毕,就跳走goods了,取消默认跳转,即可

  9. vue报错 Uncaught TypeError: Cannot read property of null

    有可能是点击a标签,但是a标签有click事件,未阻止默认事件导致报错,开始都看不出来是什么错误

随机推荐

  1. Android开发-数据库代码编写

    数据库代码主要是查找 package com.example.Utils.database; import android.annotation.SuppressLint; import androi ...

  2. 解决mybatis拦截器无法注入spring bean的问题

    公司要整合rabbitmq与mybatis拦截器做一个数据同步功能. 整合过程中大部分环节都没什么问题,就是遇到了mybatis拦截器 @Intercepts(@Signature(type = Ex ...

  3. 「ZJOI2014」星系调查

    「ZJOI2014」星系调查 本题核心在于快速求XPs 的线性假设相斥度. 点\((x1,y1)\)到直线\(y=kx+b\)的距离的平方为\(\displaystyle {(kx1+b-y1)^2} ...

  4. Git提示“warning: LF will be replaced by CRLF”

    感谢原文作者:萌新李同学(李俊德-大连理工大学) 原文链接:https://blog.csdn.net/wq6ylg08/article/details/88761581 问题描述 windows平台 ...

  5. tomcat访问所有的资源,都是用Servlet来实现的

    感谢大佬:https://www.zhihu.com/question/57400909 tomcat访问所有的资源,都是用Servlet来实现的. 在Tomcat看来,资源分3种 静态资源,如css ...

  6. Linux添加用户组和添加用户

    1.用户组 添加组:groupadd 组名 [root@Server-n93yom ~]# groupadd dev [root@Server-n93yom ~]# cat /etc/group | ...

  7. get方式和post方式的区别

     1.请求的URL地址不同:             post:"http://192.168.13.83:8080/itheima74/servlet/LoginServlet" ...

  8. 理解Laravel中的pipeline

    理解Laravel中的pipeline suoga 关注  0.1 2015.09.08 00:00* 字数 1533 阅读 7151评论 8喜欢 24 pipeline在laravel的启动过程中出 ...

  9. 解决"Uncaught (in promise) Error: Navigation cancelled from "/" to "/login" with a new navigation"报错处理

    Uncaught (in promise) Error: Navigation cancelled from "/" to "/login" with a ne ...

  10. SQLServer误删ReportServerTempDB导致打不开其他库——解决方案

    无意间删除了ReportServerTempDB库和ReportServer 导致其他库连接不上 错误:报表服务器无法打开与报表服务器数据库的连接.所有请求和处理都要求与数据库建立连接. 解决方案: ...