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

Override scrollToIndex(number) in TreeGrid #3505

Closed
sosa-vaadin opened this issue Jul 8, 2021 · 3 comments · Fixed by #4934
Closed

Override scrollToIndex(number) in TreeGrid #3505

sosa-vaadin opened this issue Jul 8, 2021 · 3 comments · Fixed by #4934
Assignees
Labels
enhancement New feature or request Impact: High

Comments

@sosa-vaadin
Copy link
Contributor

Describe your motivation

TreeGrid inherits the scrollToIndex(int) method from Grid but some complications arise from this. The complete structure of the Grid is needed to properly calculate how to scroll to an item using its index. One example is a node at index 3 with 5 children is expanded, the following node (previously at index 4) would move to index 9. When collapsed, the node at index 9 would move back to index 4.

Describe the solution you'd like

We need to provide a reliable method that can consistently scroll to any item using its index. The tree should be traversed in a pre-order traversal manner.

Describe alternatives you've considered

Making it possible to only scroll to root nodes. I'm not sure if this solution would work if any node is expanded since we would probably face the previous issue of having a node's index change when previous nodes are expanded or collapsed.

@sirbris
Copy link

sirbris commented Jan 10, 2023

Any updates on this?

@yuriy-fix
Copy link
Contributor

We need to implement the Flow counterpart of the logic introduced in the web-components with vaadin/web-components#5428. We would like to keep the existing API, so we should have two methods available:

public void scrollToIndex(int rowIndex)
public void scrollToIndex(int... indexes)

@tomivirkki
Copy link
Member

Also

  • Update the implementation of scrollToEnd as advised here
  • Add API for scrolling to a hierarchical index to the TreeGridElement (TB)
  • Re-enable the tests annotated with @Ignore("Fix as part of https://github.com/vaadin/flow-components/issues/3505")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Impact: High
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants