Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scrollToItem conflicts with gridItems #773

Closed
4 tasks done
homersimpsons opened this issue Nov 25, 2022 · 1 comment
Closed
4 tasks done

scrollToItem conflicts with gridItems #773

homersimpsons opened this issue Nov 25, 2022 · 1 comment

Comments

@homersimpsons
Copy link

Describe the bug

A call to scrollToItem require the user to set a value for gridItems:

scrollToItem (index) {
let scroll
if (this.itemSize === null) {
scroll = index > 0 ? this.sizes[index - 1].accumulator : 0
} else {
scroll = Math.floor(index / this.gridItems) * this.itemSize
}
this.scrollToPosition(scroll)
},

Doing so, the library set a width to the items in px and that is by default the same as the itemSize:

https://github.com/Akryum/vue-virtual-scroller/blob/86fa98fd899487795b2d3c58d0486437d71c6892/packages/vue-virtual-scroller/src/components/RecycleScroller.vue#LL35C2-L35C11

This breaks list where the item width is 100%

Reproduction

<template>
  <div id="app">
    <RecycleScroller
      :items="items"
      v-slot="{ item }"
      :grid-items="1"
      :item-size="20"
    >
      <div height="20">{{ item.id }} This takes more than 20px witdh</div>
    </RecycleScroller>
  </div>
</template>

<script>
export default {
  setup() {
    return {
      items: [...Array(1000).keys()].map((x) => ({ id: x })),
    };
  },
};
</script>

https://stackblitz.com/edit/vue-zcyqsm?file=src/App.vue

System Info

NA (stackblitz)

Used Package Manager

yarn

Validations

@Akryum Akryum closed this as completed in 7c809ad Dec 14, 2022
@wchbrad
Copy link

wchbrad commented Mar 13, 2023

Hello, when will the fix version for this issue be released, components that depend on this will not work properly for now .Thank you for your reply.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants