Vaadin Grid

Grid in vaadin is used to represent the data as we do in table in html so grid is the way to represent the  data in vaadin so mainly grid is a vaadin component.

Grid has a header footer Row and Column to represent data .

First of all to represent a data we need a data so that for that we can take a simple Array list.

List<food> myfood = Arrays.asList(new food("maggie", 1),
    new food("pasta", 2),
    new food("pizza",3)); // this we got the data to present

Now initializing a Grid in vaadin same is the way as in ArrayList.
Grid<food>=new Grid<>();// Taking Grid
grid.setItems(myfood); // given here the array of Food
grid.addColumn(food::getfoodName).setCaption("FoodName");
grid.addColumn(qty::getfoodqty).setCaption("FoodQty");
layout.addComponent(grid);
grid.setSelectionMode(SelectionMode.MULTI);// can also add if we want select the
multiple columns

Comments

Popular posts from this blog

State space search / blocks world problem by heuristic approach /TIC TAC TOE

Navigation in Vaadin.

Drag and drop items from one Grid to another