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

Component: VirtualScroll in DataTable is not scrolling to the top after table value change #2641

Closed
nikolashkubelev opened this issue Jun 7, 2022 · 1 comment

Comments

@nikolashkubelev
Copy link

Describe the bug

Once the value is changed (e.g. remove rows in the beginning) for DataTable with VirtualScroll it doesn't scroll content to the first row.

Screen.Recording.2022-06-07.at.03.11.59.mov

Reproducer

https://codesandbox.io/s/amazing-meitner-j4zxk8?file=/src/DataTableDemo.vue

PrimeVue version

3.12.6

Vue version

3.x

Language

ALL

Build / Runtime

Vite

Browser(s)

Chrome 101

Steps to reproduce the behavior

  1. Click the 'Slice' button
  2. The virtual scroll top value remains the same

Expected behavior

  1. Click the 'Slice' button
  2. The virtual scroll should scroll to the first row
@nikolashkubelev nikolashkubelev added the Type: Bug Issue contains a bug related to a specific component. Something about the component is not working label Jun 7, 2022
@tugcekucukoglu tugcekucukoglu added Status: Pending Review Issue or pull request is being reviewed by Core Team and removed Type: Bug Issue contains a bug related to a specific component. Something about the component is not working labels Jun 7, 2022
@mertsincan
Copy link
Member

mertsincan commented Jul 4, 2022

Hi,

Please update your itemSize property to 45.5 as the actual height of the DataTable's row is 45.5.
https://codesandbox.io/s/wonderful-hellman-5qureq
In addition, I've added getVirtualScrollerRef method to public API. You can access it via $refs.<your_dataTable> And then, you can scroll to an item index you want using virtualScroller API's methods.
Exp;
this.$refs.dt.getVirtualScrollerRef().scrollToIndex(0);

#2756

Best Regards,

@mertsincan mertsincan removed the Status: Pending Review Issue or pull request is being reviewed by Core Team label Jul 4, 2022
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

3 participants