use of com.vaadin.flow.component.grid.Grid in project flow-components by vaadin.
the class GridItemRefreshPage method createTemplateGrid.
private void createTemplateGrid() {
Grid<Bean> grid = new Grid<>();
grid.setHeight("500px");
grid.addColumn(Bean::getFirstField).setHeader("First Field");
grid.addColumn(Bean::getSecondField).setHeader("Second Field");
grid.addColumn(UPDATE_RENDERER.withProperty("thirdField", bean -> bean.thirdField)).setHeader("mutation");
List<Bean> items = createItems(1000);
grid.setItems(items);
grid.setId("template-grid");
Div div = new Div();
div.setText("Template Grid");
add(div, grid);
addButtons(grid, items, "template-");
}
use of com.vaadin.flow.component.grid.Grid in project flow-components by vaadin.
the class GridSingleSelectionPage method setDeselectAllowedAndSetItems.
private Grid<String> setDeselectAllowedAndSetItems() {
Grid<String> grid = new Grid<>();
GridSingleSelectionModel gssm = (GridSingleSelectionModel) grid.getSelectionModel();
// Set deselectAllowed to false
gssm.setDeselectAllowed(false);
// Set Items for grid
grid = setItemsGrid(grid, ITEMS_GRID);
Button text = new Button();
grid.addSelectionListener(e -> {
if (e.getFirstSelectedItem().isPresent()) {
text.setId("item" + e.getFirstSelectedItem().get());
text.setText("The row " + e.getFirstSelectedItem().get() + " is selected");
add(text);
}
});
return grid;
}
use of com.vaadin.flow.component.grid.Grid in project flow-components by vaadin.
the class OverrideClientValidationPage method createGridSetup.
private void createGridSetup() {
selectInGrid = new Select<>();
Grid<String> grid = new Grid<>();
grid.setItems("test");
grid.addColumn(new ComponentRenderer<>(item -> selectInGrid, (component, item) -> component));
add(new H1("Grid select usage"), grid);
}
Aggregations