有条件渲染的selectItem的更新不起作用 [英] Update of a conditionally rendered selectItem not working

查看:65
本文介绍了有条件渲染的selectItem的更新不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道为什么更新表单不会更新有条件渲染的selectItem. commandButton(出于测试目的)已按预期正确更新.

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?

谢谢
强尼

推荐答案

f:selectItem没有rendered属性.

根据此答案,您可以使用<c:if>作为包装器,也可以修改f:selecItems的列表>在您的操作方法中.

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.

这篇关于有条件渲染的selectItem的更新不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆