Skip to content

Commit

Permalink
CLDR-17658 Virtual scroller, work in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
btangmu committed Jun 5, 2024
1 parent 9e92497 commit 58551fa
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tools/cldr-apps/js/src/views/DashboardWidget.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
:items="filteredEntries"
key-field="xpstrid"
:min-item-size="54"
ref="dynamicScrollerRef"
>
<template v-slot="{ item, index, active }">
<DynamicScrollerItem
Expand Down Expand Up @@ -242,6 +243,29 @@ export default {
const el = document.querySelector(selector);
if (el) {
el.scrollIntoView(true);
} else {
// Generally el is null with DynamicScroller so try this instead.
// The method scrollToItem appears to be internal, undocumented, but this works.
for (let i = 0; i < this.filteredEntries.length; i++) {
const entry = this.filteredEntries[i];
if (entry.xpstrid == xpstrid) {
const scroller = this.$refs.dynamicScrollerRef;
if (!scroller) {
this.console.warn("No scroller for scrollToCategory");
} else if (!scroller.scrollToItem) {
this.console.warn(
"No scroller.scrollToItem for scrollToCategory"
);
} else {
this.console.log(
"Calling scroller for scrollToCategory, i = " + i
);
scroller.scrollToItem(i);
}
return;
}
}
this.console.warn("No xpstrid for scrollToCategory");
}
}
},
Expand Down Expand Up @@ -325,6 +349,7 @@ export default {
*/
updatePath(json) {
cldrDash.updatePath(this.data, json);
this.filterEntries();
},
resetScrolling() {
Expand Down

0 comments on commit 58551fa

Please sign in to comment.