Ia m new to vVadin. I created one project with grid with two columns but i want to add one Textfield column and one checkbox column and check all checkboxes when click on header checkbox.
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);
can anyone suggest me.how to add those two columns
Selection via check boxes works with the multi selection mode, see docs. On the same page you can read about ComponentRenderer
which allows to put any component in a column. Note that this feature is available since Vaadin 8.1. released few days ago.
来源:https://stackoverflow.com/questions/45384276/how-to-check-all-checkboxes-usingheader-checkbox-in-vaadin