2017-07-29 70 views
0

如何使用vVadin新建複選框。我創建了一個帶有兩列網格的項目,但我想添加一個Textfield列和一個複選框列,並在單擊標題複選框時選中所有複選框。如何使用vaadin檢查所有使用複選框的複選框

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); 

任何人都可以提出me.how添加這兩列通過複選框

+0

答案有幫助嗎? –

回答

0

選擇工作與多選擇模式,見docs。在同一頁面上,您可以閱讀有關ComponentRenderer的信息,它允許將任何組件放入列中。請注意,此功能自Vaadin 8.1起可用。前幾天發佈。

相關問題