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

docs: add warning about unreliable behaviour of scrollToIndex(int) in TreeGrid #1882

Merged
merged 3 commits into from
Jul 15, 2021

Conversation

sosa-vaadin
Copy link
Contributor

Description

The scrollToIndex(int) method in TreeGrid is directly inherited from Grid but has some issues. The grid needs to know the entire tree structure to accurately calculate a node's index (in a pre-order traversal method). Since it uses lazy loading for performance reasons, there is no reliable way to consistently scroll to a node's position.

Let's document this behavior in the TreeGrid class version of the method and discourage the use of it until we find a proper solution.

Related: vaadin/web-components#1016, #3505

@manolo
Copy link
Member

manolo commented Jul 14, 2021

Shouldn't this be cherry-picked to 20.0 ?

@vaadin-bot
Copy link
Collaborator

SonarQube analysis reported 17 issues

  • CRITICAL 3 critical
  • MAJOR 3 major
  • MINOR 3 minor
  • INFO 8 info

Top 10 issues

  1. CRITICAL TreeGrid.java#L291: Define a constant instead of duplicating this literal "TreeGrid only accepts hierarchical data providers. " 6 times. rule
  2. CRITICAL TreeGrid.java#L292: Define a constant instead of duplicating this literal "An example of interface to be used: HierarchicalDataProvider" 6 times. rule
  3. CRITICAL TreeGrid.java#L334: Define a constant instead of duplicating this literal "Use another setDataProvider/setItems method instead with hierarchical data." 5 times. rule
  4. MAJOR TreeGrid.java#L656: Call "Optional#isPresent()" before accessing the value. rule
  5. MAJOR TreeGrid.java#L657: Either log or rethrow this exception. rule
  6. MAJOR TreeGrid.java#L673: Either log or rethrow this exception. rule
  7. MINOR TreeGrid.java#L201: Move this constructor to comply with Java Code Conventions. rule
  8. MINOR TreeGrid.java#L311: Remove this use of "setDataProvider"; it is deprecated. rule
  9. MINOR TreeGrid.java#L956: Remove this method to simply inherit it. rule
  10. INFO TreeGrid.java#L330: Do not forget to remove this deprecated code someday. rule

@sosa-vaadin sosa-vaadin merged commit 40dfc3a into master Jul 15, 2021
@sosa-vaadin sosa-vaadin deleted the docs/scroll-to-index branch July 15, 2021 07:45
sosa-vaadin added a commit that referenced this pull request Jul 19, 2021
… TreeGrid (#1882)

Co-authored-by: Manuel Carrasco Moñino <manolo@vaadin.com>
manolo added a commit that referenced this pull request Jul 19, 2021
… TreeGrid (#1882) (#1908)

Co-authored-by: Manuel Carrasco Moñino <manolo@vaadin.com>

Co-authored-by: Manuel Carrasco Moñino <manolo@vaadin.com>
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

Successfully merging this pull request may close these issues.

None yet

4 participants