From eb039608f99d24eb30a6ecae3cfe60f337572776 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Julius=20H=C3=A4rtl?= <jus@bitgrid.net>
Date: Sun, 18 Nov 2018 10:34:35 +0100
Subject: [PATCH] Make number of file list entries depending on the width for
 grid view
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Julius Härtl <jus@bitgrid.net>
---
 apps/files/js/filelist.js | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index 83510762c1a..94fdada937d 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -99,7 +99,14 @@
 		 * @return {int} page size
 		 */
 		pageSize: function() {
-			return Math.max(Math.ceil(this.$container.height() / 50), 1);
+			var isGridView = this.$showGridView.is(':checked');
+			var columns = 1;
+			var rows = Math.ceil(this.$container.height() / 50);
+			if (isGridView) {
+				columns = Math.ceil(this.$container.width() / 160);
+				rows = Math.ceil(this.$container.height() / 160);
+			}
+			return Math.max(columns*rows, columns);
 		},
 
 		/**
-- 
GitLab