How to attach a rich:tooltip
to the list generated by f:selectItems
when using a variable for the attribute for
inside the rich:tooltip
.
This code works fine (the value of #{prefix}
is theprefixvalue
<ui:composition>
<a4j:form id="#{prefix}_form">
<h:selectOneRadio style="text-align:left" id="#{prefix}_rating">
<f:selectItems value="#{test.options}"></f:selectItems>
</h:selectOneRadio>
<rich:toolTip for="theprefixvalue_form\:theprefixvalue_rating\:0">a</rich:toolTip>
</a4j:form>
</ui:composition>
But this code does not:
<ui:composition>
<h:outputText value="#{prefix}" />
<a4j:form id="#{prefix}_form">
<h:selectOneRadio style="text-align:left" id="#{prefix}_rating">
<f:selectItems value="#{test.options}"></f:selectItems>
</h:selectOneRadio>
<rich:toolTip for="#{prefix}_form\:#{prefix}_rating\:0">a</rich:toolTip>
</a4j:form>
</ui:composition>
Throws the following exception:
Caused by: java.lang.IllegalArgumentException: theprefixvalue_rating
at javax.faces.component.UIComponentBase.findComponent(UIComponentBase.java:612)
at org.ajax4jsf.renderkit.RendererUtils.findComponentFor(RendererUtils.java:1037)
at org.richfaces.renderkit.html.ToolTipRenderer.getTargetId(ToolTipRenderer.java:234)
at org.richfaces.renderkit.html.ToolTipRenderer.constructJSVariable(ToolTipRenderer.java:251)
...
TestBean is session scoped and this is the code for getOptions();
public List<SelectItem> getOptions(){
List<SelectItem> options = new ArrayList<SelectItem>();
options.add(new SelectItem("a","a"));
options.add(new SelectItem("b","b"));
options.add(new SelectItem("c","c"));
return options;
}
Any ideas? The goal is to have a tooltip when the mouse is over the different options. Thanks in advance.
Edit: Apparently HtmlSelectOneRadio
is not implementing NamingContainer
, so it fails at UIComponentBase
line 611:
(result
is an instance of HtmlSelectOneRadio
, length>0
and segments[1] = "theprefixvalue_rating"
)
if (result != null && (!(result instanceof NamingContainer)) && length > 0) {
throw new IllegalArgumentException(segments[i]);
I am trying to use my own NamedHtmlSelectOneRadio
which extends HtmlSelectOneRadio
and implements NamingContainer
but I'm still guessing how to inject it with facelets. Any idea?