April 2018
Intermediate to advanced
202 pages
4h 48m
English
The read CRUD operation can be thought of as the action of showing all the User instances inside the Grid.
Since the Grid doesn't have any columns at this point, adding rows to it won't make any difference, so let's start by adding columns. The easiest way to add columns to a Grid is by passing the type of the bean (User) to the Grid constructor:
Grid grid = new Grid(User.class);
After this, we can add columns by using the property names in the bean. For example:
grid.setColumns("firstName", "lastName");
However, this is not type-safe. When manually adding columns to a Grid, a better approach is not to use the Grid(Class<T> beanType) constructor, and instead use a ValueProvider. Let's do this in the example ...
Read now
Unlock full access