Skip to content

Commit

Permalink
fix: Expose layoutHints in JS API for TreeTable (#5555)
Browse files Browse the repository at this point in the history
- You could set layout hints in Groovy, but they were not accessible through the JS API
- Required for DH-17076
  • Loading branch information
mofojed authored and stanbrub committed Jun 4, 2024
1 parent 9e932b5 commit fc685f5
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@ private enum RebuildStep {
private Column rowExpandedCol;
private final Column actionCol;
private final JsArray<Column> groupedColumns;
private JsLayoutHints layoutHints;

// The source JsTable behind the original HierarchicalTable, lazily built at this time
private final JsLazy<Promise<JsTable>> sourceTable;
Expand Down Expand Up @@ -1082,6 +1083,25 @@ public String getDescription() {
return tableDefinition.getAttributes().getDescription();
}

@JsProperty
@JsNullable
public JsLayoutHints getLayoutHints() {
if (layoutHints == null) {
createLayoutHints();
}
return layoutHints;
}

private void createLayoutHints() {
String hintsString = tableDefinition.getAttributes().getLayoutHints();
JsLayoutHints jsHints = new JsLayoutHints();
if (hintsString == null) {
layoutHints = null;
} else {
layoutHints = jsHints.parse(hintsString);
}
}

/**
* The current number of rows given the table's contents and the various expand/collapse states of each node. (No
* totalSize is provided at this time; its definition becomes unclear between roll-up and tree tables, especially
Expand Down

0 comments on commit fc685f5

Please sign in to comment.