Bugzilla – Attachment 159343 Details for
Bug 32474
Implement infinite scroll in vue-select
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32474: Fix persistence of selections when pagination re-triggers
Bug-32474-Fix-persistence-of-selections-when-pagin.patch (text/plain), 2.54 KB, created by
Matt Blenkinsop
on 2023-11-29 15:59:54 UTC
(
hide
)
Description:
Bug 32474: Fix persistence of selections when pagination re-triggers
Filename:
MIME Type:
Creator:
Matt Blenkinsop
Created:
2023-11-29 15:59:54 UTC
Size:
2.54 KB
patch
obsolete
>From a7d9fe87bd58ec3a7c785ae43cd08681968b4e80 Mon Sep 17 00:00:00 2001 >From: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com> >Date: Wed, 29 Nov 2023 14:54:33 +0000 >Subject: [PATCH] Bug 32474: Fix persistence of selections when pagination > re-triggers > >Currently when the select is closed and then re-opens, the pagination is re-triggered which removes the data that the lable is being pulled from for the select. This patch addresses this by keeping the currently selected piece of data and adding it into the re-paginated array of data. >--- > .../vue/components/InfiniteScrollSelect.vue | 24 ++++++++++++++++++- > 1 file changed, 23 insertions(+), 1 deletion(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/InfiniteScrollSelect.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/InfiniteScrollSelect.vue >index 9dac42b808..ccce19d481 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/InfiniteScrollSelect.vue >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/InfiniteScrollSelect.vue >@@ -76,6 +76,18 @@ export default { > }, > methods: { > async fetchInitialData(dataType) { >+ let currentSelection >+ if (this.modelValue) { >+ const dataToPersist = this.data.find( >+ item => this.modelValue === item[this.dataIdentifier] >+ ) >+ const preSelectedData = this.selectedData[this.dataIdentifier] >+ ? this.selectedData >+ : null >+ currentSelection = dataToPersist >+ ? dataToPersist >+ : preSelectedData >+ } > const client = APIClient.erm > await client[dataType] > .getAll( >@@ -88,7 +100,17 @@ export default { > ) > .then( > items => { >- this.data = items >+ const checkDuplicate = items.find( >+ item => >+ currentSelection[this.dataIdentifier] === >+ item[this.dataIdentifier] >+ ) >+ currentSelection = checkDuplicate >+ ? null >+ : currentSelection >+ this.data = currentSelection >+ ? [currentSelection, ...items] >+ : items > this.search = "" > this.limit = 19 > this.scrollPage = 1 >-- >2.37.1 (Apple Git-137.1)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 32474
:
144614
|
144719
|
144720
|
145143
|
145144
|
145154
|
150030
|
150031
|
150282
|
150283
|
150284
|
150287
|
150305
|
150308
|
150309
|
153110
|
153111
|
153112
|
153113
|
154094
|
156410
|
156470
|
156471
|
156472
|
156473
|
156474
|
156475
|
156476
|
156477
|
156478
|
156479
|
156481
|
156482
|
156483
|
156504
|
156505
|
159327
|
159328
|
159329
|
159330
|
159340
|
159343
|
159386
|
159389
|
159395
|
159397
|
159398
|
159399
|
159400
|
159401
|
159402
|
159403
|
159404
|
159405
|
159406
|
159407
|
161724