【问题标题】:DataTables: Uncaught TypeError: Cannot read property 'mData' of undefined数据表:未捕获的类型错误:无法读取未定义的属性“mData”
【发布时间】:2016-05-22 15:58:13
【问题描述】:

我想在我的页面中使用 DataTable 显示表格:

<table id="example" class="display" cellspacing="0" width="100%">
    <thead>
        <tr>
            <th>Username</th>
            <th>Firstname</th>
            <th>Lastname</th>
            <th>Phone</th>
            <th>Password</th>
            <th></th>
        </tr>
    </thead>
    <tfoot>
       <tr>
            <th>Username</th>
            <th>Firstname</th>
            <th>Lastname</th>
            <th>Phone</th>
            <th>Password</th>
            <th></th>
            <th></th>
        </tr>
    </tfoot>
    <tbody>
        <c:forEach items="${users}" var="user" varStatus="status">
            <tr>
                <form>
                    <td class="text-center">${user.getUsername()}</td>
                    <td class="text-center">${user.getFirstname()}</td>
                    <td class="text-center">${user.getLastname()}</td>
                    <td class="text-center">${user.getPhone()}</td>
                    <td class="text-center">${user.getPassword()}</td>
                </form>
                <td class="text-center"><button class="btn btn-user"   onclick="show('block','${user.getUsername()}')">Delete</button></td>
                <td class="text-center"><button class="btn btn-user" onclick="show2('block','${user.getFirstname()}','${user.getLastname()}','${user.getUsername()}', '${user.getPhone()}','${user.getPassword()}')">Edit</button></td>
            </tr>
      </c:forEach>
    </tbody>
</table>

但我收到错误:未捕获的类型错误:无法读取未定义的属性“mData”

我该如何解决这个问题?

【问题讨论】:

  • 我解决了我的问题:在 中缺少

标签: javascript html twitter-bootstrap jsp datatables


【解决方案1】:

我解决了我的问题:&lt;thead&gt; 中缺少 &lt;th&gt;&lt;/th&gt;

【讨论】:

    猜你喜欢
    • 2015-08-02
    • 1970-01-01
    • 2016-06-28
    • 2016-04-10
    • 2017-06-05
    • 1970-01-01
    • 1970-01-01
    • 2013-05-29
    相关资源
    最近更新 更多