Merge pull request #21509 from owncloud/users-scrolltop

Keep scroll position in users page when sorting
This commit is contained in:
Thomas Müller 2016-01-13 11:00:48 +01:00
commit ca4f24aa97
1 changed files with 8 additions and 1 deletions

View File

@ -259,6 +259,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) {
@ -284,6 +288,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
@ -605,10 +611,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>'));