简体   繁体   English

带有渲染规则的 p:radioButton 永远不会被渲染

[英]p:radioButton with render rule is never rendered

EDIT: I adjusted the code, but the problem remains.编辑:我调整了代码,但问题仍然存在。 See below见下文

I have this p:selectOneRadio :我有这个p:selectOneRadio

<p:selectOneRadio 
    value="#{bean.val}"
    id="val"
    layout="custom"
>
    <f:selectItem itemLabel="" itemValue="A" />
    <f:selectItem itemLabel="" itemValue="B" />
    <p:ajax update="wrapper AData" />
</p:selectOneRadio>

and this p:radioButton :这个p:radioButton

<h:panelGroup id="wrapper">
    <p:radioButton for="val" itemIndex="0" rendered="#{bean.val != 'A'}"/>
</h:panelGroup>

and AData contains other inputs.AData包含其他输入。 They are displayed only if the first radio is selected.只有在选择了第一个收音机时才会显示它们。 But this is not important.但这并不重要。

When I get a fresh page, both the radios are displayed.当我得到一个新页面时,两个收音机都会显示出来。 When I select one of them , the first one disappear .当我选择其中一个时第一个消失

The expected behavior by me is that the first radio disappear when selected , and re-appear when the other one is selected .我的预期行为是第一个收音机在选择时消失,当另一个收音机选择重新出现

EDIT2: I tried to remove the rendered . EDIT2:我试图删除rendered . It continued to not work!它继续到不行 After I removed the update, it remains visible.删除更新后,它仍然可见。 But render does not work, so the radio never disappear.但是渲染不起作用,所以收音机永远不会消失。

What I'm wronging?我有什么不妥?

I found the solution.我找到了解决方案。 The problem was I have to update an ancestor in common with both the p:selectOneRadio and the p:radioButton问题是我有两个更新共同祖先的p:selectOneRadiop:radioButton

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM