javascript - Sort by all columns in table pure angular -
i trying give table ability sort columns, having bit of trouble. pulling data webservice populate table want sort wherever user wants. have plunker here. of close attempt. thinking this:
$scope.order = function(predicate, reverse) { $scope.recentalerts = orderby($scope.recentalerts, predicate, reverse); };
like angular website might work, having bit of trouble integrating own table. doing wrong? or there easier way so? i'd stick plain angular this example.
your example working (after fixing plunkr), force reverse
false
.
if want reproduce angular do, inverse reverse
parameter on each click, instance add somehting this:
$scope.orders[predicate] = !$scope.orders[predicate]; $scope.recentalerts = orderby($scope.recentalerts, predicate, $scope.orders[predicate]);
see working plunkr:
http://plnkr.co/edit/z9ldlwvwwv82d65pfif6?p=preview
or in simpler form, use common $scope.reverse
attribute:
Comments
Post a Comment