Update of a conditionally rendered selectItem not working

丶灬走出姿态 提交于 2019-12-24 08:00:39

问题


I'm wondering why updating a form won't update a conditionally rendered selectItem. The commandButton (for testing purposes) is updated correctly as expected.

<h:form id="form">
    <h:selectOneMenu id="selectedGroupId" label="#{msgs.group_group}" value="#{groupBean.selectedGroupId}">
        <p:ajax event="change" listener="#{groupBean.selectGroupEvent}" update=":form"/>
        <f:selectItem rendered="#{empty groupBean.selectedGroupId}" itemLabel="#{msgs.global_select_select}" />
        <f:selectItems value="#{groupBean.availableGruppen}" />
   </h:selectOneMenu>
   <p:commandButton value="Test" actionListener="#{groupBean.test}" rendered="#{empty groupBean.selectedGroupId}"/> 
</h:form>

Any hints what I'm doing wrong here?

Thanks
Jonny


回答1:


There is no rendered attribute for f:selectItem.

According to this answer, you can use a <c:if> as a wrapper instead or modify your list of f:selecItems in your action method.



来源:https://stackoverflow.com/questions/10346618/update-of-a-conditionally-rendered-selectitem-not-working

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!