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

时间:2016-04-12 07:22:18

标签: jquery angularjs twitter-bootstrap datatables-1.10

我无法发帖提问。请参阅随附的屏幕截图以了解错误。

enter image description here

<table>
  <tr ng-repeat="num in numbers">
    <td> {{num.number}} </td>
    <td> {{num.short_description}} </td>
    <td> {{num.category}} </td>
    <td> {{num.subcategory}} </td>
    <td> {{num.priority}} </td>
    <td> {{num.urgency}} </td>
  </tr>
</table>

1 个答案:

答案 0 :(得分:2)

数据表需要使用<thead><tbody>格式正确的表格HTML 此外,所有行中<th>的数量和<td>的数量应匹配。 (但可以在标题中使用colspan) 试试这个HTML -

<table class="table table-striped" id="my_incidents_details" border="1">
        <thead>
                <tr>
                         <th>Number</th>
                         <th>Short Description</th>
                         <th>Category</th>
                         <th>Sub Category</th>
                         <th>Priority</th>
                         <th>Urgency</th>
                </tr>
        </thead>
        <tbody>                     
          <tr ng-repeat="num in numbers">

                 <td>  {{num.number}} </td> 
                 <td>{{num.short_description}}</td>
                 <td>  {{num.category}} </td> 
                 <td>  {{num.subcategory}} </td> 
                 <td>  {{num.priority}} </td> 
                 <td>  {{num.urgency}} </td> 

                                             </tr>
            </tbody>                                 
</table>