aboutsummaryrefslogtreecommitdiffstats
path: root/documentation/components
diff options
context:
space:
mode:
authorAleksi Hietanen <aleksi@vaadin.com>2017-03-21 15:53:59 +0200
committerHenri Sara <henri.sara@gmail.com>2017-03-21 15:53:59 +0200
commitd1fa1a3efe08e0843a38947dcd8ffe65e04ed12c (patch)
treea2757bfac569b6e718b68281ba9d2e0a8c6803bb /documentation/components
parent2dc8c1b5ad81c0dd800225b6185f47fe952251f7 (diff)
downloadvaadin-framework-d1fa1a3efe08e0843a38947dcd8ffe65e04ed12c.tar.gz
vaadin-framework-d1fa1a3efe08e0843a38947dcd8ffe65e04ed12c.zip
Add collapse and expand events to TreeGrid (#8889)
Closes #8760
Diffstat (limited to 'documentation/components')
-rw-r--r--documentation/components/components-treegrid.asciidoc13
1 files changed, 13 insertions, 0 deletions
diff --git a/documentation/components/components-treegrid.asciidoc b/documentation/components/components-treegrid.asciidoc
index b0e28fee5f..d3a431c3e9 100644
--- a/documentation/components/components-treegrid.asciidoc
+++ b/documentation/components/components-treegrid.asciidoc
@@ -93,3 +93,16 @@ treeGrid.addColumn(Project::getHoursDone).setCaption("Hours Done");
treeGrid.setHierarchyColumn("name");
----
+== Listening to Events
+
+In addition to supporting all the listeners of the standard [classname]#Grid#, [classname]#TreeGrid# supports listening to the expansion and collapsing of items in its hierarchy.
+The expand and collapse listeners can be added as follows:
+
+[source, java]
+----
+treeGrid.addExpandListener(event -> log("Item expanded: " + event.getExpandedItem()));
+treeGrid.addCollapseListener(event -> log("Item collapsed: " + event.getCollapsedItem()));
+----
+
+The return types of the methods `getExpandedItem` and `getCollapsedItem` are the same as the type of the [classname]#TreeGrid# the events originated from.
+Note that collapse listeners will not be triggered for any expanded subtrees of the collapsed item.