Cannot read property 'aDataSort' of undefined for dynamic datatable

4.5k views Asked by At

all from this http//jsfiddle.net/v6ruo7mj/1/ I created a dynamic data table, now I wanted to add the pagination, so I used jQuery data table and angular data table. but it was throwing Cannot read property 'aDataSort' of undefined and Cannot read property 'parentNode' of null errors. when I googled and I found it was due to empty thead. But I am binding that thead dynamically. there is a slight modification in my code. I added thead tag to the header. and tbody tag to the rows(data).

1

There are 1 answers

0
dimson d On

with this plugin ( https://github.com/michaelbromley/angularUtils/tree/master/src/directives/pagination ) your html would be:

<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>