0

when i try to sort the data while clicking on column header, data is not sorting when i click in first column header, the data is sorting only for first two columns, could anybody knows where is am wrong actually! this is my controller code `var orderBy = $filter('orderBy');

      $scope.gridTestData = [{ "firstname": "john", "lastname": "Jackson", "gender": "M", "status": "1" }, { "firstname": "jr", "lastname": "Jackson", "gender": "F", "status": "0" }, { "firstname": "robort", "lastname": "jr", "gender": "M", "status": "1" }];

$scope.order = function(predicate) {
  $scope.predicate = predicate;
  $scope.reverse = ($scope.predicate === predicate) ? !$scope.reverse : false;
  $scope.gridTestData = orderBy($scope.gridTestData, predicate, $scope.reverse);
};
$scope.order('age', true);`

This is my Plunker

2
  • I think it is sorting, just you cannot see as the values are the same for both direction :) Commented Mar 15, 2016 at 12:08
  • Thanks i didn't see the data :P Commented Mar 15, 2016 at 12:21

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.