Code:
<ice:selectManyCheckbox value="#{viewMatrix.checked}">
<f:selectItems value="#{viewMatrix.mainList}" />
</ice:selectManyCheckbox>
select items value is a list of SelectItem where value is string like:
Code:
mainList.add(new SelectItem("1:2", "a"));
mainList.add(new SelectItem("1:3", "b"));
mainList.add(new SelectItem("1:4", "c"));
mainList.add(new SelectItem("2:1", "d"));
mainList.add(new SelectItem("2:2", "e"));
mainList.add(new SelectItem("2:3", "f"));
To check first and last checkbox I have to add to viewMatrix.checked
Code:
List<String> checked;
checked.add("1:2");
checked.add("2:3") ;
需要注意初始化 SelectItem ( ID,Value )时 传入的 ID 数据类型