Browse Source

Add setHierarchyColumn(column) overload to TreeGrid

tags/8.1.0.alpha8
Aleksi Hietanen 7 years ago
parent
commit
f4bbe48069
1 changed files with 24 additions and 0 deletions
  1. 24
    0
      server/src/main/java/com/vaadin/ui/TreeGrid.java

+ 24
- 0
server/src/main/java/com/vaadin/ui/TreeGrid.java View File

@@ -136,6 +136,30 @@ public class TreeGrid<T> extends Grid<T>
super.setDataProvider(dataProvider);
}

/**
* Set the column that displays the hierarchy of this grid's data. By
* default the hierarchy will be displayed in the first column.
* <p>
* Setting a hierarchy column by calling this method also sets the column to
* be visible and not hidable.
* <p>
* <strong>Note:</strong> Changing the Renderer of the hierarchy column is
* not supported.
*
* @param column
* the column to use for displaying hierarchy
*/
public void setHierarchyColumn(Column<T, ?> column) {
Objects.requireNonNull(column, "column may not be null");
if (!getColumns().contains(column)) {
throw new IllegalArgumentException(
"Given column is not a column of this TreeGrid");
}
column.setHidden(false);
column.setHidable(false);
getState().hierarchyColumnId = getInternalIdForColumn(column);
}

/**
* Set the column that displays the hierarchy of this grid's data. By
* default the hierarchy will be displayed in the first column.

Loading…
Cancel
Save