我最近收到了一个 Vaadin 7 项目,其中之前的开发人员使用 Vaadin 7 Grid grid.addRow(obj) 向网格添加行。现在,在 Vaadin 8 Grid 中添加了 grid.setItems(? Collection ?) ,它完全清除了 grid.setItems() 上网格中的数据。我观看了 Vaadin 的所有 YouTube 视频和所有堆栈溢出页面,但没有找到答案。
我确实发现这个论坛有很多人有同样的问题: https://vaadin.com/forum# !/thread/15724440
这是我的工作,我并不为此感到自豪。基本上添加一个 ArrayList 作为我的示例使用具有名字、姓氏、电子邮件和薪水的 Person 类。
@SpringUI(path = "/person")
@Theme("valo")
public class PersonForm extends UI{
@Autowired
PersonService personService;
List<Person> entries = new ArrayList<Person>();
private TextField firstName = new TextField("First Name");
private TextField lastName = new TextField("Last Name");
private TextField email = new TextField("Email Address");
private TextField salary = new TextField("Salary");
private Person person = new …Run Code Online (Sandbox Code Playgroud)