我的问题是h:selectManyCheckbo在导航时丢失了值,这是我的代码:
<h:selectManyCheckbox id="selectGroupsBox"
value="{userCreationWizardBean.selectedGroupsId}"
layout="pageDirection">
<f:selectItems var="Group"
value="#{userCreationWizardBean.terminalsGroups}"
itemLabel="#{terminalsGroup.groupName}"
itemValue="#{terminalsGroup.id}"
itemDisabled="#{Group.defaultGroup}">
</f:selectItems>
<p:ajax event="change" update=":form-top-wizard:numBase" process="selectGroupsBox"
listener="#{userCreationWizardBean.selectedGroupListner}"></p:ajax>
</h:selectManyCheckbox>
如果我使用导航键来回走动,CheckBox会丢失值:
<div id="top-wizard" class="#{class}">
<ul>
<li class="premier#{wizard_step=='0'?'_active':''}"><p:commandLink
action="#{userCreationWizardBean.getViewAt(0)}" ajax="true"
update=":msg-form:popup_faces-messages"
/></li>
<li class="deuxieme#{wizard_step=='1'?'_active':''}"><p:commandLink
action="#{userCreationWizardBean.getViewAt(1)}" ajax="true"
update=":msg-form:popup_faces-messages"
/></li>
<li class="troisieme#{wizard_step=='2'?'_active':''}"><p:commandLink
action="#{userCreationWizardBean.getViewAt(2)}" ajax="true"
update=":msg-form:popup_faces-messages"
/></li>
<li class="quatrieme#{wizard_step=='3'?'_active':''}"><p:commandLink
action="#{userCreationWizardBean.getViewAt(3)}" ajax="true"
update=":msg-form:popup_faces-messages"
/></li>
</ul>
</div>
当我删除itemDisabled属性时,问题就会消失。
似乎我可以使用jquery css选择器语法来排除正在处理的复选框,但仅在primefaces 3.3中,但我使用的是3.2。