]> source.dussan.org Git - nextcloud-server.git/commitdiff
port scroll improvements
authorArthur Schiwon <blizzz@owncloud.com>
Thu, 20 Feb 2014 17:42:03 +0000 (18:42 +0100)
committerArthur Schiwon <blizzz@owncloud.com>
Mon, 2 Jun 2014 10:53:52 +0000 (12:53 +0200)
settings/js/users/users.js

index 3ef6706b98cde34d58c55ca1de40fc16d173f96b..8b1d04e2a36b47c56d61a4c22b33160bfdd0ca41 100644 (file)
@@ -11,6 +11,7 @@ var UserList = {
                                //hardcoded in settings/users.php
 
        usersToLoad: 10, //So many users will be loaded when user scrolls down
+       currentGid: '',
 
        /**
         * @brief Initiate user deletion process in UI
@@ -237,7 +238,10 @@ var UserList = {
                if(gid === undefined) {
                        gid = '';
                }
+               UserList.currentGid = gid;
                $.get(OC.Router.generate('settings_ajax_userlist', { offset: UserList.offset, limit: UserList.usersToLoad, gid: gid }), function (result) {
+                       var loadedUsers = 0;
+                       var trs = [];
                        if (result.status === 'success') {
                                //The offset does not mirror the amount of users available,
                                //because it is backend-dependent. For correct retrieval,
@@ -371,8 +375,8 @@ var UserList = {
                if (!!UserList.noMoreEntries) {
                        return;
                }
-               if ($(window).scrollTop() + $(window).height() > $(document).height() - 500) {
-                       UserList.update(true);
+               if (UserList.scrollArea.scrollTop() + UserList.scrollArea.height() > UserList.scrollArea.get(0).scrollHeight - 500) {
+                       UserList.update(UserList.currentGid, true);
                }
        },
 };
@@ -394,6 +398,7 @@ $(document).ready(function () {
        UserList.doSort();
        UserList.availableGroups = $('#content table').data('groups');
        $(window).scroll(function(e) {UserList._onScroll(e);});
+               UserList.scrollArea.scroll(function(e) {UserList._onScroll(e);});
        $('table').after($('<div class="loading" style="height: 200px; visibility: hidden;"></div>'));
 
        $('select[multiple]').each(function (index, element) {