Dave Maple
Dave Maple

Reputation: 8432

Rerender child of composite component

Is there a way to specify a child component of a composite component to re-render using f:ajax:

<f:ajax render="compositeComponent:childComponent" />

From my brief experimentation it doesn't seem possible to reference them but I wondered if there was an alternate strategy to accomplish this.

Upvotes: 1

Views: 831

Answers (1)

BalusC
BalusC

Reputation: 1109875

It should work fine. It's fully client side (i.e., the JSF-generated JavaScript code locates it in the HTML DOM tree).

Probably you referenced the wrong client ID. Open the page in the webbrowser, rightclick and View Source, locate the generated HTML element in the page source and determine its id attribute. The one which you specify in the render attribute should refer either absolutely (prefix with :) or relatively (as compared to the parent UINamingContainer component) to it.

Another possible cause is that you have put the rendered attribute on the very same composite component's child which evaluated false which in turn caused that the generated HTML element is totally missing in the HTML DOM tree. You would then like to put the rendered attribute on a child of that component instead, like so:

<h:panelGroup id="childComponent">
    <h:outputText value="#{bean.text}" rendered="#{bean.rendered}" />
</h:panelGroup>

Upvotes: 1

Related Questions