use of com.vaadin.flow.component.grid.Grid in project flow-components by vaadin.
the class GridWithTemplatePage method createStandaloneGridWithTemplatesInTheHeader.
private void createStandaloneGridWithTemplatesInTheHeader() {
Grid<String> grid = new Grid<>();
setCommonGridFeatures(grid, "standalone-template-in-header");
grid.addColumn(value -> value).setHeader(getTestTemplate("header", grid.getId().get())).setFooter(getTestTemplate("footer", grid.getId().get()));
add(new H3("Grid with templates in the header and footer"), grid);
}
use of com.vaadin.flow.component.grid.Grid in project flow-components by vaadin.
the class ContextMenuGridPage method gridInATemplateWithContextMenu.
private void gridInATemplateWithContextMenu() {
GridInATemplate template = new GridInATemplate();
Grid<String> gridInATemplate = template.getGrid();
gridInATemplate.addColumn(s -> s).setHeader("Item");
gridInATemplate.setItems(IntStream.range(0, 26).mapToObj(i -> "Item " + i));
GridContextMenu<String> contextMenu = gridInATemplate.addContextMenu();
contextMenu.addItem("Show name of context menu target item", e -> message.setText(e.getItem().orElse(NO_TARGET_ITEM)));
add(template);
}
use of com.vaadin.flow.component.grid.Grid in project flow-components by vaadin.
the class GridMultiSelectionColumnPage method createBasicGridFromMultiToSingleBeforeAttached.
private void createBasicGridFromMultiToSingleBeforeAttached() {
Grid<String> grid = new Grid<>();
grid.setItems(IntStream.range(0, ITEM_COUNT).mapToObj(Integer::toString));
setUp(grid);
grid.setId("in-testing-multi-selection-mode-grid-single");
add(new H2("in-testing-multi-selection-mode-grid-single"), grid);
grid.setSelectionMode(SelectionMode.MULTI);
grid.setSelectionMode(SelectionMode.SINGLE);
add(grid);
}
use of com.vaadin.flow.component.grid.Grid in project flow-components by vaadin.
the class GridMultiSelectionColumnPage method createDefinedItemCountLazyGrid.
private void createDefinedItemCountLazyGrid() {
Grid<String> lazyGrid = new Grid<>();
lazyGrid.setItems(query -> IntStream.range(query.getOffset(), query.getOffset() + query.getLimit()).mapToObj(Integer::toString), query -> ITEM_COUNT);
setUp(lazyGrid);
lazyGrid.setId(DEFINED_ITEM_COUNT_LAZY_GRID_ID);
add(new H2("Lazy grid"), lazyGrid);
}
use of com.vaadin.flow.component.grid.Grid in project flow-components by vaadin.
the class GridMultiSelectionColumnPage method createBasicGridMultiOneRowDeSelected.
private void createBasicGridMultiOneRowDeSelected() {
Grid<String> grid = new Grid<>();
grid.setId(MULTI_SELECT_GRID_ONE_NOT_SELECTED_GRID_ID);
grid.setItems(IntStream.range(0, 2).mapToObj(Integer::toString));
grid.addColumn(i -> i).setHeader("text");
grid.addColumn(i -> String.valueOf(i.length())).setHeader("length");
grid.setSelectionMode(Grid.SelectionMode.MULTI);
grid.getSelectionModel().select("1");
NativeButton selectRow0Button = new NativeButton("Select Row 0");
selectRow0Button.setId("selectRow0");
selectRow0Button.addClickListener(event -> {
grid.getSelectionModel().select("0");
});
add(new H2("Grid with two rows only one row selected"), grid, selectRow0Button);
}
Aggregations