Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions articles/components/tree-grid/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,9 @@ endif::[]

Tree Grid supports programmatic navigation to a specific item. This is particularly useful when dealing with large data sets. It saves users from having to scroll through potentially hundreds or thousands of rows.

[role="since:com.vaadin:[email protected]"]
=== Scrolling to Item (Flow only)
To use this feature, you need to specify the item you want to view. The scroll position of the grid is adjusted to bring that item into view.
=== Scrolling to Item By Reference [badge-flow]#Flow#

If the item has collapsed parents, they expand before scrolling to the item.
In Flow, you can bring an item into view by passing its object reference to the [methodname]`scrollToItem(T item)` method. This method expands all parent items leading to the specified item and then scrolls the Tree Grid to position that item at the top of the viewport. Scrolling is skipped if the item is already in the viewport and fully visible.

[.example]
--
Expand All @@ -147,10 +145,14 @@ include::{root}/src/main/java/com/vaadin/demo/component/treegrid/TreeGridScrollT
----
--

`TreeDataProvider` supports this feature out of the box. For other data providers, you need to override and implement the following methods of [classname]`HierarchicalDataProvider`:
This feature is available out of the box when using <<../tree-grid/data-binding#tree-data-provider, `TreeDataProvider`>>, a built-in data provider for connecting a <<../tree-grid/data-binding#tree-data-provider,`TreeData`>> structure to the Tree Grid.

- [methodname]`getParent(T item)`
- [methodname]`getItemIndex(T item, HierarchicalQuery query)`
Other data providers must implement two additional methods to support this feature:

* [methodname]`HierarchicalDataProvider#getParent(T item)`
* [methodname]`HierarchicalDataProvider#getItemIndex(T item, HierarchicalQuery query)`

You can find more information about using custom hierarchical data providers on the <<../tree-grid/data-binding#custom-data-providers,Data Binding>> page.

=== Scrolling to Item by Path

Expand Down