From 598a892d2ca94f275c23f2480728ebcaad33deb6 Mon Sep 17 00:00:00 2001 From: Andrew Scott Date: Wed, 11 Sep 2024 09:08:32 -0700 Subject: [PATCH] fix: #380 --- .../src/components/input/c-list-page.vue | 24 +++++++++++-------- src/coalesce-vue/src/viewmodel.ts | 2 +- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/coalesce-vue-vuetify3/src/components/input/c-list-page.vue b/src/coalesce-vue-vuetify3/src/components/input/c-list-page.vue index 6f6d8f226..0a4d2142d 100644 --- a/src/coalesce-vue-vuetify3/src/components/input/c-list-page.vue +++ b/src/coalesce-vue-vuetify3/src/components/input/c-list-page.vue @@ -4,7 +4,7 @@ variant="outlined" size="x-small" icon - @click="list.$previousPage()" + @click="list.$page = effectivePage - 1" :disabled="!list.$hasPreviousPage" title="Previous Page" > @@ -17,7 +17,8 @@ type="number" min="1" :max="list.$load.pageCount === -1 ? null : list.$load.pageCount" - v-model.number="list.$page" + :modelValue="effectivePage" + @update:model-value="list.$page = +$event" hide-details density="compact" variant="outlined" @@ -32,7 +33,7 @@ variant="outlined" size="x-small" icon - @click="list.$nextPage()" + @click="list.$page = effectivePage + 1" :disabled="!list.$hasNextPage" title="Next Page" > @@ -41,15 +42,18 @@ - diff --git a/src/coalesce-vue/src/viewmodel.ts b/src/coalesce-vue/src/viewmodel.ts index 172e517c2..16833163e 100644 --- a/src/coalesce-vue/src/viewmodel.ts +++ b/src/coalesce-vue/src/viewmodel.ts @@ -1505,7 +1505,7 @@ export abstract class ListViewModel< return this.$params.page || 1; } public set $page(val) { - this.$params.page = Number(val); + this.$params.page = Math.max(1, Number(val)); } public get $pageSize() {