use of com.vaadin.flow.component.grid.Grid.SelectionMode in project flow-components by vaadin.
the class TreeGridBasicFeaturesPage method createSelectionModeMenu.
@SuppressWarnings("rawtypes")
private void createSelectionModeMenu() {
LinkedHashMap<String, SelectionMode> options = new LinkedHashMap<>();
options.put("none", SelectionMode.NONE);
options.put("single", SelectionMode.SINGLE);
options.put("multi", SelectionMode.MULTI);
options.entrySet().forEach(entry -> {
addAction("Selection mode - " + entry.getKey(), () -> {
grid.setSelectionMode(entry.getValue());
if (entry.getValue() == SelectionMode.MULTI) {
GridSelectionModel model = grid.getSelectionModel();
if (model instanceof GridMultiSelectionModel) {
((GridMultiSelectionModel) model).setSelectAllCheckboxVisibility(SelectAllCheckboxVisibility.VISIBLE);
}
}
});
});
}
Aggregations