summaryrefslogtreecommitdiffstats
path: root/settings
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2016-01-07 15:48:59 +0100
committerVincent Petry <pvince81@owncloud.com>2016-01-13 15:37:10 +0100
commit2a9a1b8a4ddbd6257b37f4c91cbcdc9a2827f111 (patch)
treef97e554bbef24eed77468a40b8d8467bc42de171 /settings
parentf56e05fde0d6d9a768dd436e6534971be87db669 (diff)
downloadnextcloud-server-2a9a1b8a4ddbd6257b37f4c91cbcdc9a2827f111.tar.gz
nextcloud-server-2a9a1b8a4ddbd6257b37f4c91cbcdc9a2827f111.zip
Keep scroll position in users page when sorting
When sorting, some browsers like Chrome will lose the scroll position, possibly because the sorting code is touching the DOM elements. This fix saves the scroll position before sorting and sets it back afterwards.
Diffstat (limited to 'settings')
-rw-r--r--settings/js/users/users.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/settings/js/users/users.js b/settings/js/users/users.js
index 2a4baa0e5bf..512f147364f 100644
--- a/settings/js/users/users.js
+++ b/settings/js/users/users.js
@@ -255,6 +255,10 @@ var UserList = {
}
},
doSort: function() {
+ // some browsers like Chrome lose the scrolling information
+ // when messing with the list elements
+ var lastScrollTop = this.scrollArea.scrollTop();
+ var lastScrollLeft = this.scrollArea.scrollLeft();
var rows = $userListBody.find('tr').get();
rows.sort(function(a, b) {
@@ -280,6 +284,8 @@ var UserList = {
if(items.length > 0) {
$userListBody.append(items);
}
+ this.scrollArea.scrollTop(lastScrollTop);
+ this.scrollArea.scrollLeft(lastScrollLeft);
},
checkUsersToLoad: function() {
//30 shall be loaded initially, from then on always 10 upon scrolling
@@ -609,10 +615,11 @@ $(document).ready(function () {
// Implements User Search
OCA.Search.users= new UserManagementFilter(UserList, GroupList);
+ UserList.scrollArea = $('#app-content');
+
UserList.doSort();
UserList.availableGroups = $userList.data('groups');
- UserList.scrollArea = $('#app-content');
UserList.scrollArea.scroll(function(e) {UserList._onScroll(e);});
$userList.after($('<div class="loading" style="height: 200px; visibility: hidden;"></div>'));