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

Dropdown: VirtualScrollerRef access for scrollToIndex #4489

Closed
BorisZoretic98 opened this issue Jun 7, 2023 · 1 comment · Fixed by #4490 or #4491
Closed

Dropdown: VirtualScrollerRef access for scrollToIndex #4489

BorisZoretic98 opened this issue Jun 7, 2023 · 1 comment · Fixed by #4490 or #4491
Assignees
Labels
Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add
Milestone

Comments

@BorisZoretic98
Copy link

Describe the bug

I'm working with the Dropdown component of primereact using virtualScrollerOptions. I would like to have access to the virtualScollerRef so I can use methods like scrollToIndex.

I'm personnaly using v8 of primereact but the issue also exists in v9.

Reproducer

No response

PrimeReact version

9.5.0

React version

17.x

Language

TypeScript

Build / Runtime

Create React App (CRA)

Browser(s)

No response

Steps to reproduce the behavior

No response

Expected behavior

No response

@BorisZoretic98 BorisZoretic98 added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Jun 7, 2023
@melloware melloware added Typescript Issue or pull request is *only* related to TypeScript definition and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Jun 7, 2023
@melloware melloware self-assigned this Jun 7, 2023
@melloware melloware added this to the 9.6.0 milestone Jun 7, 2023
melloware added a commit to melloware/primereact that referenced this issue Jun 7, 2023
@melloware
Copy link
Member

ok with this fix in the typescript you should be able to do the following after 9.6.0.

const ref = useRef(null);

<Dropdown ref={ref}... />

const onClick = () => {
   ref.current.getVirtualScroller().scrollToIndex(4); // scroll to item 4 in list
}

melloware added a commit to melloware/primereact that referenced this issue Jun 7, 2023
@melloware melloware added Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add and removed Typescript Issue or pull request is *only* related to TypeScript definition labels Jun 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement Issue contains an enhancement related to a specific component. Additional functionality has been add
Projects
None yet
2 participants