vendredi 18 août 2017

Vaadin 8 Checkbox Group select() doesn't work for array

I have code from Vaadin 8 sample:

    List data = Arrays.asList(0, 1, 2, 3, 4, 5);
    sample = new CheckBoxGroup<>("Select options", data);        
    sample.setItemCaptionGenerator(item -> "Option " + item);         
    sample.select(data.get(2), data.get(3));        
    sample.setItemEnabledProvider(item -> item % 2 != 0);

What I need is to cast my method to it:

 public void setAnswer(String answer) {
    String[] answers = answer.split(",");
    answerCheckBoxes.select(answers);
  }

But this code selects only first element of array. What I need is to select all elements. Does any body knows where is my mistake?




Aucun commentaire:

Enregistrer un commentaire