简体   繁体   English

自定义 p:radioButton 在表内不起作用:找不到 select 的 ID

[英]Custom p:radioButton does not work inside a table: id of select not found

I have a table, and I want to put inside any row of this table a custom p:radioButton , on two different columns.我有一个表,我想在这个表的任何行内放置一个自定义的p:radioButton ,在两个不同的列上。

This is the code of the p:selectOneRadio :这是p:selectOneRadio的代码:

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

and this is the code of one of the radioButton :这是其中一个radioButton的代码:

<p:radioButton for="tabs:table:#{i}:val" itemIndex="0"/>

I checked with the browser and the id is right.我检查了浏览器,id 是正确的。 Anyway, I get this error:无论如何,我得到这个错误:

javax.faces.FacesException: Cannot find component 'tabs:table:0:val' in view. javax.faces.FacesException:在视图中找不到组件“tabs:table:0:val”。

What could be the problem?可能是什么问题呢? Please help:)请帮忙:)

I'm using Primefaces 3.4.1 with Mojarra 2.1.7我正在使用 Primefaces 3.4.1 和 Mojarra 2.1.7

Well, the solution was simple, and it was suggested to me by BalusC :好吧,解决方案很简单, BalusC向我建议:

<p:radioButton for="val" itemIndex="0"/>

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

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