Skip to content

Commit

Permalink
Uses deep watcher to fix table scrolling issue (#1413)
Browse files Browse the repository at this point in the history
* Uses deepwatcher

* Change to use item

* Removes parent from slot

* Version bump
  • Loading branch information
orelbn authored Jul 5, 2023
1 parent 8c8f72c commit 5c87895
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 12 deletions.
4 changes: 2 additions & 2 deletions ppr-ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ppr-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ppr-ui",
"version": "2.0.20",
"version": "2.0.21",
"private": true,
"appName": "Assets UI",
"sbcName": "SBC Common Components",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
:clearable="isClearable"
@keypress="showAllGroups()"
>
<template v-slot:item="{ parent, item }">
<template v-slot:item="{ item }">
<template v-if="item.class === 'registration-list-header'">
<v-list-item-content>
<v-row
Expand All @@ -47,7 +47,7 @@
</template>
<template v-else>
<v-list-item-content class="py-3 registration-list">
<span class="registration-list-item" v-html="`${parent.genFilteredText(item.text)}`"></span>
<span class="registration-list-item" v-html="item.text"></span>
</v-list-item-content>
</template>
</template>
Expand Down
19 changes: 12 additions & 7 deletions ppr-ui/src/components/tables/RegistrationTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -693,20 +693,25 @@ export default defineComponent({
if (!localState.firstColRef || val < 350) localState.overrideWidth = false
})
// Triggers scrolling on changes to the registration history
watch(() => props.setRegistrationHistory,
() => {
if (localState.newReg?.addedReg) {
// need both (only one ref will scroll)
scrollToRef(newRegItem)
scrollToRef(newAndFirstItem)
}
},
{ deep: true }
)
onUpdated(() => {
// needed to set overrideWidth to true
if (localState.firstColRef?.value?.length > 0) {
if (localState.firstColRef.value[0].clientWidth > 350) {
localState.overrideWidth = true
}
}
// if new reg -> scroll to new reg
if (localState.newReg?.addedReg) {
// need both (only one ref will scroll)
scrollToRef(newRegItem)
scrollToRef(newAndFirstItem)
}
})
return {
Expand Down

0 comments on commit 5c87895

Please sign in to comment.