AngularJS ngTable with server side loading

96 views Asked by At

I tried to use ngTable with server side sorting and pagination.

The html:

   <table ng-table="dataTable" class="table table-striped">
          <tr ng-repeat="row in $data">
                    <td data-title="'Name'" sortable="'name'">{{row.name}}
                    </td>
         </tr>
   </table>

In the controller :

    $scope.dataTable= new ngTableParams({
                page: 1,          
                count: 10,         
                sorting: {
                    name: 'desc'   
                }
            }, {
                counts: [],
                total: 0,
                getData: function($defer, params) {
                    ... httpGet according to the params, server returns just the relevant for selected 
                        page

                }
            });

getData function is called in page change, and works fine. but sort is sorting just the page, and not calls getData. can I use this directive to mu need?

0

There are 0 answers