Skip to content

Commit 2d47993

Browse files
authored
docs: improve JavaDoc for TreeGridElement#getRowCount (#8107)
1 parent 008113d commit 2d47993

File tree

1 file changed

+9
-15
lines changed
  • vaadin-grid-flow-parent/vaadin-grid-testbench/src/main/java/com/vaadin/flow/component/grid/testbench

1 file changed

+9
-15
lines changed

vaadin-grid-flow-parent/vaadin-grid-testbench/src/main/java/com/vaadin/flow/component/grid/testbench/TreeGridElement.java

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -344,23 +344,17 @@ public boolean hasRow(int rowFlatIndex) {
344344
}
345345

346346
/**
347-
* Gets the total number of rows.
347+
* Gets the total number of rows currently known to TreeGrid.
348348
* <p>
349-
* Note that for TreeGrid this does not return reliable results if rows are
350-
* expanded. Due to the lazy-loading nature of the grid, children of
351-
* expanded rows are only loaded into the grid when they are scrolled into
352-
* view. Likewise, they are removed again from the grid at some point when
353-
* they are scrolled out of view. These child rows then only count against
354-
* the total row count while they are loaded into the grid. Effectively,
355-
* that means that the total row count will depend on the scroll position of
356-
* the grid.
349+
* This method returns the actual total number of rows across the entire
350+
* expanded tree only when TreeGrid uses a {@code HierarchyFormat#FLATTENED}
351+
* data provider.
357352
* <p>
358-
* We are looking into making this more reliable by adding additional APIs
359-
* to TreeGrid that would allow the component to keep track of the total
360-
* number of rows just based on the expanded rows, and regardless of the
361-
* scroll position. Please see
362-
* <a href="https://github.com/vaadin/flow-components/issues/7269">this
363-
* issue</a> for more details.
353+
* For data providers that return data in {@code HierarchyFormat#NESTED},
354+
* hierarchy levels are discovered lazily – only when they appear in the
355+
* viewport, which makes it impossible to determine the total number of rows
356+
* in advance. As a result, this method may return a lower number that will
357+
* gradually increase as more expanded rows have been seen.
364358
*
365359
* @return the number of rows
366360
*/

0 commit comments

Comments
 (0)