rows.add() and databindings

rows.add() and databindings

vivendivivendi Posts: 15Questions: 1Answers: 0

This is not really a DataTables question, but more geared towards AngularJS. But I'm hoping someone knows a way to handle this, since DataTables does play a role in this issue.

I'm rendering table rows by using AngularJS. My table looks like this:

    <table test1="" id="data" class="table">
        <thead>
            <tr>
                <th>Id</th>
                <th>name</th>
                <th>action</th>
            </tr>
        </thead>
        <tbody>
            <tr ng-repeat="foo in entries">
                <td>{{$index + 1}}</td>
                <td>User {{$index + 1}}</td>
                <td><a href="#" ng-click="msg()">link {{$index + 1}}</a>
                </td>
            </tr>
        </tbody>
    </table>

So AngularJS renders this table and adds bindings to the href link in the last column.

I also have functionality in AngularJS that calls DataTables.rows.add( someDataArray ) to add a new row to the table. The problem I then have is that the binding doesn't work on the newly added row. It still work for all the other rows that were added by AngularJS itself. But not the row that is added by DataTables.

I'm hoping someone here already found a solution for this problem. I'm looking for a way to "re-bind" that ng-click binding.

Anyone any idea how to fix this problem?

This discussion has been closed.