List view editor, makes sorting work

This commit is contained in:
Tim Geyssens
2013-09-19 13:42:11 +02:00
parent 18c00e21ce
commit d9dae1e71a
2 changed files with 14 additions and 12 deletions

View File

@@ -25,17 +25,19 @@ angular.module("umbraco")
$scope.reloadView();
};
$scope.sort = function(field){
$scope.options.sortby = field;
$scope.sort = function (field) {
$scope.options.orderBy = field;
if(field !== $scope.options.sortby){
if($scope.options.order === "desc"){
$scope.options.order = "asc";
}else{
$scope.options.order = "desc";
}
if ($scope.options.orderDirection === "desc") {
$scope.options.orderDirection = "asc";
}else{
$scope.options.orderDirection = "desc";
}
$scope.reloadView();
$scope.reloadView($scope.content.id);
};
$scope.prev = function(){

View File

@@ -20,9 +20,9 @@
<thead>
<tr>
<td with="20"><input type="checkbox"></td>
<td><a href="#" ng-click="sort('name')" prevent-default>Name <i class="icon-sort"></i></a></td>
<td><a href="#" ng-click="sort('updateDate')" prevent-default>Last updated <i class="icon-sort"></i></a></td>
<td><a href="#" ng-click="sort('owner')" prevent-default>Editor <i class="icon-sort"></i></a></td>
<td><a href="#" ng-click="sort('Name')" prevent-default>Name <i class="icon-sort"></i></a></td>
<td><a href="#" ng-click="sort('UpdateDate')" prevent-default>Last updated <i class="icon-sort"></i></a></td>
<td><a href="#" ng-click="sort('Owner')" prevent-default>Editor <i class="icon-sort"></i></a></td>
<td with="20"><form class="pull-right" novalidate>
<i class="icon-search"></i>
<input type="text" ng-model="options.filter" on-keyup="reloadView()">