From c308e7377a5020eca9d9b8b775695bf1397b6a2e Mon Sep 17 00:00:00 2001 From: "totally-not-ai[bot]" <290682512+totally-not-ai[bot]@users.noreply.github.com> Date: Tue, 15 Sep 2026 11:27:45 +0000 Subject: [PATCH] docs: note the Vaadin 26 hierarchy format default change Vaadin 25.3 deprecates the setItems and setTreeData shorthands and the single-argument TreeDataProvider constructor, because the hierarchy format they default to changes from NESTED to FLATTENED in Vaadin 26. The Tree Grid data binding page documented neither the deprecation nor the coming change, so a reader following it hits a deprecation warning with no explanation. Both places now say what changes, that it affects methods like scrollToIndex, and how to keep the current behavior by passing the format explicitly. --- articles/components/tree-grid/data-binding.adoc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/articles/components/tree-grid/data-binding.adoc b/articles/components/tree-grid/data-binding.adoc index 86c36ba212..3df56df823 100644 --- a/articles/components/tree-grid/data-binding.adoc +++ b/articles/components/tree-grid/data-binding.adoc @@ -61,6 +61,11 @@ TreeDataProvider treeDataProvider = (TreeDataProvider) treeGrid. The next section explains the [classname]`TreeData` and [classname]`TreeDataProvider` concepts in more detail, and how to use them to modify, sort, and filter hierarchical data. +[NOTE] +==== +[since:com.vaadin:vaadin@V25.3]#The [methodname]`setItems()` and [methodname]`setTreeData()` shorthand methods are deprecated.# They create a [classname]`TreeDataProvider` with [enumname]`HierarchyFormat.NESTED` today, but will create one with [enumname]`HierarchyFormat.FLATTENED` starting from Vaadin 26. That affects Tree Grid methods whose behavior depends on the hierarchy format, such as [methodname]`scrollToIndex()`. To keep the current behavior, create the [classname]`TreeDataProvider` yourself with [enumname]`HierarchyFormat.NESTED` and set it with [methodname]`setDataProvider()`, as shown in the next section. +==== + == Tree Data Provider @@ -96,6 +101,8 @@ include::{root}/src/main/java/com/vaadin/demo/component/treegrid/databinding/Fol [NOTE] ==== Using the [enumname]`HierarchyFormat.FLATTENED` option with [classname]`TreeDataProvider` is recommended to ensure Tree Grid preserves its scroll position after the TreeData's hierarchy is modified. More details about hierarchy formats are provided later in this article in the <<#hierarchy-formats,Hierarchy Formats>> section. + +[since:com.vaadin:vaadin@V25.3]#The single-argument [classname]`TreeDataProvider` constructor is deprecated# for the same reason as the shorthand methods above: it defaults to [enumname]`HierarchyFormat.NESTED` today, and to [enumname]`HierarchyFormat.FLATTENED` starting from Vaadin 26. Pass the format explicitly to state which one the application wants. ==== === Adding Items