angularjs - Order by Angular -


i have problem sorting data. data json. then, formulas, results , sort them. have problem sorting, need each column click sort, @ 1 time not sort it

<div class="col-sm-12"> <table border="0" class="table">     <tr>         <th ng-click="sortby('session')">type</th>         <th>height</th>         <th>time</th>         <th>distance</th>         <tr ng-repeat="y in playerstatisticsession|orderby:heartrate">             <td ng-if="sendparams() == y.player_id">{{y.type}}</td>             <td ng-if="sendparams() == y.player_id">{{getheight(y.player_id) | number: 2}}</td>             <td ng-if="sendparams() == y.player_id">*****</td>             <td ng-if="sendparams() == y.player_id">{{getmaxdistance(y.player_id, y.table_activity_id) / x.max * 100 | number:2}}% ({{getmaxdistance(y.player_id,                 y.table_activity_id)}})             </td>         </tr> </table> 

$http.get("http://localhost:8080/api/playerstatisticsession") .then(function successcallback(response) { console.log("/playerstatisticsession") $scope.playerstatisticsession = response.data.playerstatisticsession; }, function errorcallback(response) { console.log("error!"); });  $scope.propertyname = 'session'; $scope.reverse = false; $scope.sessions = orderby($scope.propertyname, $scope.reverse);  $scope.sortby = function (propertyname) { $scope.reverse = (propertyname !== null && $scope.propertyname ===  propertyname)     ? !$scope.reverse : false; $scope.propertyname = propertyname; $scope.sessions = orderby($scope.propertyname, $scope.reverse); }; 


Comments

Popular posts from this blog

Sort a complex associative array in PHP -

vb.net - How to ignore if a cell is empty nothing -

recursion - Can every recursive algorithm be improved with dynamic programming? -