diff --git a/fx/README.md b/fx/README.md
index cc1ebe3..dc826a0 100644
--- a/fx/README.md
+++ b/fx/README.md
@@ -710,3 +710,8 @@ The reference above covers the FXML declarations and their behavior. These are t
`property(name)` returns `Property>`: cast to the known property type when writing from Java, for example `((StringProperty) loaded.property("name")).set("Grace")`. Generated accessors avoid these casts. `storedProperty` is for subclasses and reads only stored Model Attributes; it does not invoke custom reflective accessors. Internal loaders, appliers and identity-cache helpers are implementation details, not extension APIs.
For threading, strong identity retention, context reuse, the absence of a general disposal API, and JPMS reflection, see [architecture and lifetime](docs/architecture.md). For an independent application POM and runnable files, use the [complete quick start](docs/quick-start.md).
+
+DataGrid columns accept arbitrary string keys for group captions through the attached
+`DataGridColumn.groupLabel` property. For example,
+``
+writes the literal key into the same map as ``.
diff --git a/fx/src/main/java/de/neitzel/fx/view/DataGridColumn.java b/fx/src/main/java/de/neitzel/fx/view/DataGridColumn.java
index 846e8e0..3abe0ec 100644
--- a/fx/src/main/java/de/neitzel/fx/view/DataGridColumn.java
+++ b/fx/src/main/java/de/neitzel/fx/view/DataGridColumn.java
@@ -21,6 +21,12 @@ public final class DataGridColumn {
@Setter(lombok.AccessLevel.NONE)
private final java.util.Map groupLabels = new java.util.LinkedHashMap<>();
+ /** Adds one FXML group label whose key can contain spaces, paths or other non-name characters. */
+ public static void setGroupLabel(DataGridColumn column, javafx.util.Pair entry) {
+ column.groupLabels.put(java.util.Objects.requireNonNull(entry.getKey(), "group key"),
+ java.util.Objects.requireNonNull(entry.getValue(), "group label"));
+ }
+
private double width = 150;
private double minimumWidth = 80;
private double maximumWidth = 1200;
diff --git a/fx/src/test/java/de/neitzel/fx/view/DataGridFxmlTest.java b/fx/src/test/java/de/neitzel/fx/view/DataGridFxmlTest.java
index b28c01c..f5831a3 100644
--- a/fx/src/test/java/de/neitzel/fx/view/DataGridFxmlTest.java
+++ b/fx/src/test/java/de/neitzel/fx/view/DataGridFxmlTest.java
@@ -55,6 +55,22 @@ class DataGridFxmlTest {
""";
+ @Test
+ void groupLabelEntriesRetainLiteralKeysAlongsideMapAttributes() throws IOException {
+ String xml = """
+
+
+
+
+
+
+
+ """;
+ DataGridColumn column = new FXMLLoader().load(new ByteArrayInputStream(xml.getBytes(StandardCharsets.UTF_8)));
+ assertEquals(Map.of("Post", "Postfach", "/", "Wurzel", "Post/Eingang", "Eingang", "Ohne Endung", "Sonstige"),
+ column.getGroupLabels());
+ }
+
@Test
void loadsReusableTagAndCompletionControls() throws Exception {
DataGridTest.fx(() -> {