]> source.dussan.org Git - nextcloud-server.git/commitdiff
dynamically decide whether to load 10 or 30 users
authorArthur Schiwon <blizzz@owncloud.com>
Wed, 2 Apr 2014 19:55:57 +0000 (21:55 +0200)
committerArthur Schiwon <blizzz@owncloud.com>
Mon, 2 Jun 2014 10:53:55 +0000 (12:53 +0200)
settings/js/users/users.js

index 92ce8277baffae6d7df92ccc33f0557339f32856..481cf1586ce94c782bee1863bef9141b5bf7df80 100644 (file)
@@ -88,6 +88,7 @@ var UserList = {
                        tr.show();
                        $('tbody tr').first().remove();
                        UserList.isEmpty = false;
+                       UserList.checkUsersToLoad();
                }
                if (sort) {
                        UserList.doSort();
@@ -164,6 +165,14 @@ var UserList = {
                        $('tbody').append(items);
                }
        },
+       checkUsersToLoad: function() {
+               //30 shall be loaded initially, from then on always 10 upon scrolling
+               if(UserList.isEmpty === false) {
+                       UserList.usersToLoad = 10;
+               } else {
+                       UserList.usersToLoad = 30;
+               }
+       },
        empty: function() {
                //one row needs to be kept, because it is cloned to add new rows
                $('tbody tr:not(:first)').remove();
@@ -174,6 +183,7 @@ var UserList = {
                tr.attr('data-uid', Math.random().toString(36).substring(2));
                UserList.isEmpty = true;
                UserList.offset = 0;
+               UserList.checkUsersToLoad();
        },
        hide: function(uid) {
                $('tr[data-uid="' + uid + '"]').hide();