summaryrefslogtreecommitdiffstats
path: root/documentation/components/components-treegrid.asciidoc
diff options
context:
space:
mode:
Diffstat (limited to 'documentation/components/components-treegrid.asciidoc')
-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.