我是 vVadin 的新手。我创建了一个带有两列网格的项目,但我想添加一列文本字段和一列复选框,并在单击标题复选框时选中所有复选框。
List<Person> people = Arrays.asList(
new Person("Nicolaus Copernicus", 15),
new Person("Galileo Galilei", 15),
new Person("Johannes Kepler", 15));
TextField txt =new TextField();
CheckBox chk=new CheckBox();
// Create a grid bound to the list
Grid<Person> grid = new Grid<>();
grid.setItems(people);
grid.addColumn(Person::getName).setCaption("Name");
grid.addColumn(Person::getAge).setCaption("Year of birth");
grid.addColumn(Person-> new TextField());
layout.addComponents(grid);
setParent(layout);
谁能建议我。如何添加这两列
通过复选框进行选择适用于多选模式,请参阅docs https://vaadin.com/docs/-/part/framework/components/components-grid.html#components.grid.selection.multi。在同一页面上,您可以阅读有关ComponentRenderer
它允许将任何组件放入列中。请注意,此功能自 Vaadin 8.1 起可用。几天前发布。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)