Search in sources :

Example 1 with GridInATemplate

use of com.vaadin.flow.component.grid.it.GridInATemplate 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);
}
Also used : IntStream(java.util.stream.IntStream) Person(com.vaadin.flow.data.bean.Person) Grid(com.vaadin.flow.component.grid.Grid) Anchor(com.vaadin.flow.component.html.Anchor) GridInATemplate(com.vaadin.flow.component.grid.it.GridInATemplate) H1(com.vaadin.flow.component.html.H1) Div(com.vaadin.flow.component.html.Div) Label(com.vaadin.flow.component.html.Label) NativeButton(com.vaadin.flow.component.html.NativeButton) Hr(com.vaadin.flow.component.html.Hr) Route(com.vaadin.flow.router.Route) GridInATemplate(com.vaadin.flow.component.grid.it.GridInATemplate)

Aggregations

Grid (com.vaadin.flow.component.grid.Grid)1 GridInATemplate (com.vaadin.flow.component.grid.it.GridInATemplate)1 Anchor (com.vaadin.flow.component.html.Anchor)1 Div (com.vaadin.flow.component.html.Div)1 H1 (com.vaadin.flow.component.html.H1)1 Hr (com.vaadin.flow.component.html.Hr)1 Label (com.vaadin.flow.component.html.Label)1 NativeButton (com.vaadin.flow.component.html.NativeButton)1 Person (com.vaadin.flow.data.bean.Person)1 Route (com.vaadin.flow.router.Route)1 IntStream (java.util.stream.IntStream)1