Ordering of accounts.

This commit is contained in:
Alexis Lahouze 2016-03-06 22:53:42 +01:00
parent 57b4846948
commit 5a1f2a9f30
2 changed files with 1 additions and 22 deletions

View File

@ -123,27 +123,6 @@ angular.module('accountant.accounts', [
account = angular.merge(account, $data);
return account.$save().then(function(data) {
// Sort accounts by name.
$scope.accounts.sort(function(a, b) {
if(a.id && b.id) {
if(a.name < b.name) {
return -1;
} else if(a.name > b.name) {
return 1;
} else {
return a.id - b.id;
}
} else if (!a.id && !b.id) {
return 0;
} else if (!a.id) {
return -1;
} else if (!b.id) {
return 1;
}
return 0;
});
Notification.success('Account #' + data.id + ' saved.');
return data;

View File

@ -37,7 +37,7 @@
<tr id="{{ account.id }}"
class="form-inline" ng-class="rowClass(account)"
ng-repeat="account in accounts" ng-init="account.getSolds()">
ng-repeat="account in accounts | orderBy:'name'" ng-init="account.getSolds()">
<td>
<span editable-text="account.name"
e-placeholder="Nom du compte"