错误码:Uncaught TypeError: Cannot read property 'field' of undefined
2018-03-18 01:23
1056 查看
错误码:Uncaught TypeError: Cannot read property ‘field’ of undefined
具体错误信息:
Uncaught TypeError: Cannot read property 'field' of undefined at HTMLTableCellElement.<anonymous> (bootstrap-table.js:506) at Function.each (jquery-1.11.3.min.js:2) at m.fn.init.each (jquery-1.11.3.min.js:2) at HTMLTableRowElement.<anonymous> (bootstrap-table.js:505) at Function.each (jquery-1.11.3.min.js:2) at m.fn.init.each (jquery-1.11.3.min.js:2) at BootstrapTable.initTable (bootstrap-table.js:497) at BootstrapTable.init (bootstrap-table.js:414) at new BootstrapTable (bootstrap-table.js:165) at HTMLTableElement.<anonymous> (bootstrap-table.js:2281)
错误源代码
<table id="table" data-toggle="table"> <tr> <th class="number title-cell">序号</th> <th class="name title-cell">产品名称</th> <th class="kind title-cell">产品种类</th> <th class="bank title-cell">银行名称</th> <th class="custorm title-cell">客户属性</th> <th class="rate title-cell">利率</th> <th class="year title-cell">贷款年限</th> <th class="money title-cell">贷款额度</th> <th class="attribute title-cell">属性列表</th> <th class="sort title-cell">排序</th> <th class="operate title-cell">操作</th> </tr> </table>
修改后代码
<table id="table" data-toggle="table"> <thead> <tr> <th class="number title-cell">序号</th> <th class="name title-cell">产品名称</th> <th class="kind title-cell">产品种类</th> <th class="bank title-cell">银行名称</th> <th class="custorm title-cell">客户属性</th> <th class="rate title-cell">利率</th> <th class="year title-cell">贷款年限</th> <th class="money title-cell">贷款额度</th> <th class="attribute title-cell">属性列表</th> <th class="sort title-cell">排序</th> <th class="operate title-cell">操作</th> </tr> </thead> </table>
原因
缺少<thead>;
在表格里的
<td>标签数量与
<th>的标签数量不一样。
解决方法
确保表格里有<thead>标签;
确保表格里的
<td>数量与
<th>数量一致。
参考连接
https://www.gyrocode.com/articles/jquery-datatables-common-javascript-console-errors/#typeerror-cannot-read-property-mdata-of-undefinedhttps://datatables.net/manual/installation#HTML
相关文章推荐
- JS —— Uncaught TypeError: Cannot read property 'slice' of undefined 错误
- aes.js:77 Uncaught TypeError: Cannot read property 'extend' of undefined(…)
- bug之bootstrap switch Uncaught TypeError: Cannot read property 'apply' of undefined
- Uncaught TypeError: Cannot read property 'decimalSeparator' of undefined
- Uncaught TypeError: Cannot read property 'msie' of undefined
- Uncaught TypeError: Cannot read property 'val' of undefined
- Uncaught TypeError: Cannot read property 'number' of undefined
- Uncaught TypeError: Cannot set property 'display' of undefined错误
- tankgame2.js:37 Uncaught TypeError: Cannot read property 'direct' of undefined(…)
- 浏览器报Uncaught TypeError: Cannot read property 'trigger' of undefined解决方案
- Uncaught TypeError: Cannot read property 'substring' of undefined
- Uncaught TypeError: Cannot read property 'msie' of undefined
- jquery.dataTables.min.js:62 Uncaught TypeError: Cannot read property 'style' of undefined原因
- js的form(load报错jquery.easyui.min.js:2837 Uncaught TypeError: Cannot read property 'tip' of undefined
- 浏览器报Uncaught TypeError: Cannot read property 'trigger' of undefined解决方案
- DataTable插件报错:Uncaught TypeError: Cannot read property 'style' of undefined
- Uncaught TypeError: Cannot read property 'length' of undefined
- javascript Uncaught TypeError: Cannot read property ... of undefined
- extjs4:Uncaught TypeError: Cannot read property 'processed' of undefined
- jQuery mobile报错 Uncaught TypeError: Cannot read property 'concat' of undefined