From 5aa3539ffb801fb76ae97d97fce1055bbb192bac Mon Sep 17 00:00:00 2001 From: AMahdy AbdElAziz Date: Thu, 1 Jun 2017 21:19:44 +0300 Subject: [PATCH] Extra 6 | Organize and remove unneeded grid columns --- src/main/java/org/vaadin/stepbystep/MyUI.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/vaadin/stepbystep/MyUI.java b/src/main/java/org/vaadin/stepbystep/MyUI.java index 272e449..39fc994 100644 --- a/src/main/java/org/vaadin/stepbystep/MyUI.java +++ b/src/main/java/org/vaadin/stepbystep/MyUI.java @@ -26,7 +26,7 @@ public class MyUI extends UI { PersonService service; HorizontalSplitPanel splitPanel = new HorizontalSplitPanel(); - Grid grid = new Grid<>(Person.class); + Grid grid = new Grid<>(); PersonEditorView editorView = new PersonEditorView(person -> { Person save = service.save(person); @@ -41,6 +41,10 @@ protected void init(VaadinRequest vaadinRequest) { listPersons(); selectDefault(); + grid.addColumn(Person::getFirstName).setCaption("First Name"); + grid.addColumn(Person::getLastName).setCaption("Last Name"); + grid.addColumn(Person::getEmail).setCaption("E-Mail"); + grid.asSingleSelect().addValueChangeListener(evt -> { Person value = evt.getValue(); if(value==null) {