【问题标题】:Cannot read property 'aDataSort' of undefined for dynamic datatable无法读取动态数据表未定义的属性“aDataSort”
【发布时间】:2016-12-23 13:55:26
【问题描述】:

全部来自这个http//jsfiddle.net/v6ruo7mj/1/ 我创建了一个动态数据表,现在我想添加分页,所以我使用了jQuery数据表和角度数据表。但它抛出 Cannot read property 'aDataSort' of undefinedCannot read property 'parentNode' of null 错误。当我用谷歌搜索时,我发现这是由于 thead 空了。但我正在动态绑定该主题。我的代码有轻微的修改。我在标题中添加了 thead 标记。和 tbody 标记到行(数据)。

【问题讨论】:

标签: javascript angularjs datatables angular-datatables


【解决方案1】:

使用此插件 (https://github.com/michaelbromley/angularUtils/tree/master/src/directives/pagination),您的 html 将是:

<div ng-controller="MyCtrl">
  <table border="1">
    <tr>
        <th ng-repeat="column in cols">{{column}}</th>
    </tr>
    <tr dir-paginate="row in rows | itemsPerPage: 3">
      <td ng-repeat="column in cols">{{row[column]}}</td>
    </tr>
  </table>
  <dir-pagination-controls></dir-pagination-controls>
</div>

【讨论】:

    猜你喜欢
    • 2016-06-29
    • 2015-04-11
    • 2020-11-11
    • 2017-01-28
    • 2015-08-01
    • 2022-01-18
    • 1970-01-01
    • 2017-03-14
    相关资源
    最近更新 更多