现在的位置: 首页 > 综合 > 正文

初始化时选中多个复选框

2014年02月25日 ⁄ 综合 ⁄ 共 681字 ⁄ 字号 评论关闭


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
数据类型

抱歉!评论已关闭.