【问题标题】:h:selectManyCheckbox loses values when navigatingh:selectManyCheckbox 在导航时丢失值
【发布时间】:2013-03-21 15:48:30
【问题描述】:

我的问题是 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。

【问题讨论】:

  • itemDisabled="Group.defaultGroup)) }" 这是 SO 帖子中的错误还是在您的代码中?
  • 抱歉我打错了
  • 您在引用的 ManagedBean 中使用什么范围类型?

标签: jsf primefaces


【解决方案1】:

我认为您遇到的问题与禁用组件或项目的值未发送到服务器这一事实有关。我也一直在尝试寻找解决方法。看看这个post,它可能会有所帮助。

【讨论】:

    猜你喜欢
    • 2013-12-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-06-04
    • 2013-12-10
    相关资源
    最近更新 更多