简体   繁体   中英

How to check all checkboxes usingheader checkbox in vaadin

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM