summaryrefslogtreecommitdiffstats
path: root/documentation/components
diff options
context:
space:
mode:
authorAleksi Hietanen <aleksi@vaadin.com>2017-05-18 09:48:10 +0300
committerHenri Sara <henri.sara@gmail.com>2017-05-18 09:48:10 +0300
commitc93b842947d5aab1d7eca1ff7f1426fe17432467 (patch)
tree67deb5352e2c413a569db150bbd7b0a58a448271 /documentation/components
parent7fa0e96cbc068f1c4e1b49312275bac85cff5260 (diff)
downloadvaadin-framework-c93b842947d5aab1d7eca1ff7f1426fe17432467.tar.gz
vaadin-framework-c93b842947d5aab1d7eca1ff7f1426fe17432467.zip
Clarify TreeData and TreeDataProvider javadocs, improve documentation (#9349)
Diffstat (limited to 'documentation/components')
-rw-r--r--documentation/components/components-treegrid.asciidoc15
1 files changed, 3 insertions, 12 deletions
diff --git a/documentation/components/components-treegrid.asciidoc b/documentation/components/components-treegrid.asciidoc
index 7f444602d9..d85178507d 100644
--- a/documentation/components/components-treegrid.asciidoc
+++ b/documentation/components/components-treegrid.asciidoc
@@ -37,20 +37,11 @@ Populating a [classname]#TreeGrid# with in-memory data can be done as follows
[source, java]
----
-Project rootProject = getRootRroject();
-
-TreeData<Project> data = new TreeData<>();
-// add a root level item with null parent
-data.addItem(null, rootProject);
-
-// Add all children for root item
-rootProject.flattened().forEach(
- project -> data.addItems(project, project.getSubProjects()));
-
+// Initialize a TreeGrid and set in-memory data
TreeGrid<Project> treeGrid = new TreeGrid<>();
-treeGrid.setDataProvider(new TreeDataProvider<>(data));
+treeGrid.setItems(getRootProjects(), Project::getSubProjects);
-// the first column gets the hierarchy indicator by default
+// The first column gets the hierarchy indicator by default
treeGrid.addColumn(Project::getName).setCaption("Project Name");
treeGrid.addColumn(Project::getHoursDone).setCaption("Hours Done");
treeGrid.addColumn(Project::getLastModified).setCaption("Last Modified");