grid content from spring repository

// This is repository interface
public interface AccountTypeRepository extends JpaRepository<AccountType, Long> {

AccountType findByOptionStartsWithIgnoreCase(String option);
List findByAccountTypeNameStartsWithIgnoreCase(String accountTypeName);
}

// this is vaadin design class
public class AccountTypeViewDesign2 extends HorizontalLayout {
protected Label lblAccountType1;
protected TextField txtAccountType1;
protected Label lblAccountTypeCode1;
protected TextField txtGroupCode1;
protected Button btnCancel;
protected Button btnUpdate;
protected Button btnAddAccountType1;
protected TextField filter; protected Grid grid;

public AccountTypeViewDesign2() {
Design.read(this);
}
}

//this is view class
public class AccountTypeView extends AccountTypeViewDesign2 implements View{
private static final long serialVersionUID = 1L;
public static final String VIEW_NAME = “accounttype”;

@Override
public void enter(ViewChangeListener.ViewChangeEvent viewChangeEvent) {

}

//this is ui class
@Theme(“mytheme”)
@SpringUI(path=“/accounttype”)
public class AccountTypeUI extends UI{

@Override
protected void init(VaadinRequest request) {

setContent(new AccountTypeViewDesign2());
}

Hi,

Here’s a good example of using a lazy-loading DataProvider for Grid with Vaadin and Spring:
https://github.com/alejandro-du/lazy-loading-spring-demo

In general for showing items in Grid in Vaadin 8 the way to go is using some kind of DataProvider, lazy loading or not. Here’s stuff about that in our docs:
https://vaadin.com/docs/v8/framework/datamodel/datamodel-providers.html

  • Katri