From 19cd6aebe5671e5e5844abc67f99ae8b02ee2c4b Mon Sep 17 00:00:00 2001 From: Jake Fulmine Date: Mon, 28 Nov 2022 17:11:03 +0100 Subject: [PATCH] fix(dashboard): properly update items per page in main list --- .../src/components/list/ListControl.svelte | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/dashboard/src/components/list/ListControl.svelte b/dashboard/src/components/list/ListControl.svelte index df5ecef7..5bf45214 100644 --- a/dashboard/src/components/list/ListControl.svelte +++ b/dashboard/src/components/list/ListControl.svelte @@ -39,6 +39,28 @@ const dispatch = createEventDispatcher(); function onViewChange(e: any) { resetPage(); + if (e.target?.value === 'card') { + switch (pageOptions.itemsPerPage) { + case 10: pageOptions.itemsPerPage = 12; + break; + case 25: pageOptions.itemsPerPage = 24; + break; + case 50: pageOptions.itemsPerPage = 60; + break; + default: pageOptions.itemsPerPage = 24; + break; + } + } else if (e.target?.value === 'list') { + switch (pageOptions.itemsPerPage) { + case 12: pageOptions.itemsPerPage = 10; + break; + case 24: pageOptions.itemsPerPage = 25; + break; + case 60: pageOptions.itemsPerPage = 50; + break; + default: pageOptions.itemsPerPage = 25 + } + } dispatch("viewChange", e.target.value); }