From 243d66b592de9e2731698645d43b4528122a6778 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Fri, 5 Apr 2024 13:59:23 +0200 Subject: [PATCH] refs #7136 use paginate when url exists --- src/components/common/VnSelectFilter.vue | 7 ++- src/pages/InvoiceIn/InvoiceInFilter.vue | 77 +++++++++++------------- 2 files changed, 40 insertions(+), 44 deletions(-) diff --git a/src/components/common/VnSelectFilter.vue b/src/components/common/VnSelectFilter.vue index 4c5cdf726..bd82e0cdb 100644 --- a/src/components/common/VnSelectFilter.vue +++ b/src/components/common/VnSelectFilter.vue @@ -60,7 +60,7 @@ const $props = defineProps({ }, limit: { type: [Number, String], - default: '30', + default: '4', }, fetchRef: { type: Object, @@ -165,11 +165,12 @@ async function onScroll(scrollEv) { const lastIndex = myOptions.value.length - 1; const optionIndex = ref.getOptionIndex(); - if (!$props.fetchRef) return; + if (!$props.url && !$props.fetchRef) return; if (direction === 'decrease') return; if (optionIndex > 0 && to === lastIndex && isLoading.value === false) { isLoading.value = true; - await $props.fetchRef.paginate(); + !$props.url && (await $props.fetchRef.paginate()); + $props.url && (await dataRef.value.paginate()); } } diff --git a/src/pages/InvoiceIn/InvoiceInFilter.vue b/src/pages/InvoiceIn/InvoiceInFilter.vue index c6c52d5c2..a55a8a874 100644 --- a/src/pages/InvoiceIn/InvoiceInFilter.vue +++ b/src/pages/InvoiceIn/InvoiceInFilter.vue @@ -30,7 +30,6 @@ const suppliersRef = ref(); limit="30" auto-load @on-fetch="(data) => (suppliers = data)" - auto-load />