数据表:无法读取未定义的属性“mData” [英] Datatables: Cannot read property 'mData' of undefined

查看:7617
本文介绍了数据表:无法读取未定义的属性“mData”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Datatables的问题。我也通过了这个链接,但没有让我任何结果。我已经包括所有的先决条件,在那里我直接解析数据到DOM。请帮我解决这个问题。

I have a issue with Datatables. I also went through this link which didnt yield me any result.I have inlcuded all the prerequisites where am parsing data directly into the DOM. Kindly help me to fix this issue.

脚本

$(document).ready(function() {
  $('.viewCentricPage .teamCentric').dataTable({
    "bJQueryUI": true,
    "sPaginationType": "full_numbers",
    "bPaginate": false,
    "bFilter": true,
    "bSort": true,
    "aaSorting": [
      [1, "asc"]
    ],
    "aoColumnDefs": [{
      "bSortable": false,
      "aTargets": [0]
    }, {
      "bSortable": true,
      "aTargets": [1]
    }, {
      "bSortable": false,
      "aTargets": [2]
    }],
  });
});


推荐答案

FYI dataTables 形成良好的桌子。它必须包含< thead> < tbody> 标记,否则会抛出此错误。还要检查以确保所有的行,包括标题行具有相同的列数。

FYI dataTables requires a well formed table. It must contain <thead> and <tbody> tags, otherwise it throws this error. Also check to make sure all your rows including header row have the same number of columns.

以下将抛出错误(无< thead& < tbody> 标记)

The following will throw error (no <thead> and <tbody> tags)

<table id="sample-table">
    <tr>
        <th>title-1</th>
        <th>title-2</th>
    </tr>
    <tr>
        <td>data-1</td>
        <td>data-2</td>
    </tr>
</table>

以下内容也会引发错误(列数不等)

The following will also throw an error (unequal number of columns)

<table id="sample-table">
    <thead>
        <tr>
            <th>title-1</th>
            <th>title-2</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>data-1</td>
            <td>data-2</td>
            <td>data-3</td>
        </tr>
    </tbody>
</table>

更多信息在此处阅读更多

这篇关于数据表:无法读取未定义的属性“mData”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆