From 8909b574facf29ca0a57ab5d75d9904c18cc6338 Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Fri, 4 Apr 2014 16:38:27 +0200 Subject: Make sure there are always enough elements visible on the page --- apps/files/js/filelist.js | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'apps/files/js') diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 3bf5b2d9672..0847edd02bb 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -570,6 +570,7 @@ window.FileList = { this.fileSummary.add(fileData, true); this.updateEmptyContent(); } + return $tr; }, @@ -823,6 +824,15 @@ window.FileList = { FileList.updateEmptyContent(); this.fileSummary.remove({type: fileEl.attr('data-type'), size: fileEl.attr('data-size')}, true); } + + var lastIndex = this.$fileList.children().length; + // if there are less elements visible than one page + // but there are still pending elements in the array, + // then directly append the next page + if (lastIndex < this.files.length && lastIndex < this.pageSize) { + this._nextPage(true); + } + return fileEl; }, /** -- cgit v1.2.3