diff options
author | Vincent Petry <pvince81@owncloud.com> | 2016-06-23 11:27:02 +0200 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2016-06-24 13:55:14 +0200 |
commit | b4cf29775849236be338fc7c8e2ad0d7f361ade7 (patch) | |
tree | 58a6f5ab91ac34c182d261dd1bdbc6423bd01b10 /apps/files/js | |
parent | 04e3da0cf51f23b501eaef34e4be771b15c6e6d2 (diff) | |
download | nextcloud-server-b4cf29775849236be338fc7c8e2ad0d7f361ade7.tar.gz nextcloud-server-b4cf29775849236be338fc7c8e2ad0d7f361ade7.zip |
Prerender file list pages to include search results
When filtering the file list, if a result is on an unrendered page,
make sure to call _nextPage() to prerender the pages in order to
display all matching results.
Diffstat (limited to 'apps/files/js')
-rw-r--r-- | apps/files/js/filelist.js | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index f249f2d35c9..18f17a7207c 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -2351,22 +2351,36 @@ * @param filter */ setFilter:function(filter) { + var total = 0; this._filter = filter; this.fileSummary.setFilter(filter, this.files); + total = this.fileSummary.getTotal(); if (!this.$el.find('.mask').exists()) { this.hideIrrelevantUIWhenNoFilesMatch(); } var that = this; + var visibleCount = 0; filter = filter.toLowerCase(); - this.$fileList.find('tr').each(function(i,e) { - var $e = $(e); + + function filterRows(tr) { + var $e = $(tr); if ($e.data('file').toString().toLowerCase().indexOf(filter) === -1) { $e.addClass('hidden'); } else { + visibleCount++; $e.removeClass('hidden'); } - }); - that.$container.trigger('scroll'); + } + + var $trs = this.$fileList.find('tr'); + do { + _.each($trs, filterRows); + if (visibleCount < total) { + $trs = this._nextPage(false); + } + } while (visibleCount < total); + + this.$container.trigger('scroll'); }, hideIrrelevantUIWhenNoFilesMatch:function() { if (this._filter && this.fileSummary.summary.totalDirs + this.fileSummary.summary.totalFiles === 0) { |