aboutsummaryrefslogtreecommitdiffstats
path: root/documentation/components
diff options
context:
space:
mode:
authorTeemu Suo-Anttila <tsuoanttila@users.noreply.github.com>2017-03-23 15:28:37 +0200
committerHenri Sara <henri.sara@gmail.com>2017-03-23 15:28:37 +0200
commit6384bc7dee5ccbaaafbbf569b758b3e6fd8a2c8b (patch)
tree419be55a19b6c4ef65876392b6e31091e1ff5c28 /documentation/components
parent17b3f23b0e526250dc134df1f7d2e6cd7f149ba5 (diff)
downloadvaadin-framework-6384bc7dee5ccbaaafbbf569b758b3e6fd8a2c8b.tar.gz
vaadin-framework-6384bc7dee5ccbaaafbbf569b758b3e6fd8a2c8b.zip
Add feature to disable collapsing items in TreeGrid (#8879)
Fixes #8846
Diffstat (limited to 'documentation/components')
-rw-r--r--documentation/components/components-treegrid.asciidoc16
1 files changed, 16 insertions, 0 deletions
diff --git a/documentation/components/components-treegrid.asciidoc b/documentation/components/components-treegrid.asciidoc
index d3a431c3e9..f3c2058f03 100644
--- a/documentation/components/components-treegrid.asciidoc
+++ b/documentation/components/components-treegrid.asciidoc
@@ -93,6 +93,22 @@ treeGrid.addColumn(Project::getHoursDone).setCaption("Hours Done");
treeGrid.setHierarchyColumn("name");
----
+== Prevent Node Collapsing
+
+[classname]#TreeGrid# supports setting a callback method that can allow or prevent the user from collapsing an expanded node.
+It can be set with [methodname]#setItemCollapseAllowedProvider# method, that takes a [interfacename]#SerializablePredicate#.
+For nodes that cannot be collapsed, the [literal]#++collapse-disabled++# class name is applied to the expansion element
+
+Avoid doing any heavy operations in the method, since it is called for each item when it is being sent to the client.
+
+Example using a predefined set of persons that can not be collapsed:
+[source, java]
+----
+Set<Person> alwaysExpanded;
+personTreeGrid.setItemCollapseAllowedProvider(person ->
+ !alwaysExpanded.contains(person));
+----
+
== 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.