Reselect first item on sort change

This commit is contained in:
Mo Bitar
2018-01-20 18:55:33 -06:00
parent 85cdba7a9e
commit b152df2af4
9 changed files with 22 additions and 17 deletions

View File

@@ -254,8 +254,11 @@ angular.module('app')
}
}
this.selectedMenuItem = function($event) {
this.showMenu = false;
this.selectedMenuItem = function($event, hide) {
if(hide) {
this.showMenu = false;
}
$event.stopPropagation();
}
this.deleteNote = function() {

View File

@@ -40,7 +40,13 @@ angular.module('app')
});
this.loadPreferences = function() {
let prevSortValue = this.sortBy;
this.sortBy = authManager.getUserPrefValue("sortBy", "created_at");
if(prevSortValue && prevSortValue != this.sortBy) {
$timeout(() => {
this.selectFirstNote();
})
}
this.sortDescending = this.sortBy != "title";
this.showArchived = authManager.getUserPrefValue("showArchived", false);

View File

@@ -13,7 +13,8 @@ class MenuRow {
buttonClass: "=",
buttonAction: "&",
spinnerClass: "=",
subRows: "="
subRows: "=",
faded: "="
};
}

View File

@@ -316,7 +316,7 @@ angular.module('app')
}
this.getUserPrefValue = function(key, defaultValue) {
if(!this.userPreferences) { return; }
if(!this.userPreferences) { return defaultValue; }
var value = this.userPreferences.getAppDataItem(key);
return (value !== undefined && value != null) ? value : defaultValue;
}

View File

@@ -109,8 +109,6 @@ class SingletonManager {
this.modelManager.setItemToBeDeleted(d);
}
console.log("Syncing from SM");
this.$rootScope.sync();
// Send remaining item to callback

View File

@@ -191,8 +191,6 @@ class SyncManager {
sync(callback, options = {}) {
console.log("Sync");
var allDirtyItems = this.modelManager.getDirtyItems();
if(this.syncStatus.syncOpInProgress) {