Docs

Documentation versions (currently viewingVaadin 25.4 (pre-release))

Tree Grid Recipes

Examples that combine Tree Grid features to solve common use cases.

This page contains examples that combine Tree Grid features to solve common use cases.

Highlighting a Subtree Flow

Custom part names can depend on the position of an item in the hierarchy. In the example below, selecting a row highlights all of its descendants with a selected-subtree part name. The part name generator checks whether the selected item is an ancestor of the rendered item. Because part names are generated only when a row is rendered, the selection listener refreshes the descendants of both the previously and the newly selected item.

Source code
TreeGridSubtreeHighlight.java
tree-grid-subtree-highlight.css
tree-grid-subtree-highlight.css

See Dynamically Styling Rows & Columns for more information about custom part names.