How order list di date get from object


#1

hi, i heve a list and i want ro order by clicking button by date. This date is taken from an object, i try this code, but it’s sort like a simple number

	     // function to order and change button by click
		     $scope.sortType = "CreationDate";
		     $scope.sortReverse = false;
		     $scope.buttonStyle = "icon ion-ios-time-outline";
		     $scope.buttonPress = false;
		     $scope.ordina = function() {

		      if ($scope.sortType == "CreationDate") {
		       $scope.sortReverse = !$scope.sortReverse;
		       console.log("riordinate");
		      }

		      $scope.buttonPress = !$scope.buttonPress;
		      if ($scope.buttonPress == true) {
		       $scope.buttonStyle = "icon ion-ios-time";
		      } else {
		       $scope.buttonStyle = "icon ion-ios-time-outline";
		      }
		     }

in html

ion-item ng-repeat=“object in allODA | filter: searchQuery | orderBy : sortType : sortReverse " href=”#/app/ODA_Detail/{{object.caseTaskId}}"

any solutions???idea???


#2

What do you mean ?

When do you reverse your sort ? is there a function associated to your click ?
Your code should work, I have the same code.


#3

the date format is 01/04/2015, at start i want to sort by date ascending…when click sort by date disccending