Is Ajax "update" ok after "render" was false?

jsf, primefaces

Solution

The ajax update works by JavaScript with the JSF-generated HTML DOM tree (as the webbrowser has retrieved). If a JSF component is not rendered, then it does not appear in the HTML DOM tree at all and hence JavaScript can't find anything to update.

You need to update a parent component instead, which is always rendered.

E.g.

<h:panelGroup id="foo">
    <h:someComponent rendered="#{bean.rendered}" />
</h:panelGroup>

with

<p:commandButton ... update="foo" />

Problem

Can I send Ajax "update" commands to JSF components that have not been rendered due to render option previously set to false: ``` render="#{BackingBean.doRender}" ``` doRender is set to `true` just before "update" has been sent. Is this the right way? I am using PrimeFaces and one component does not show after `update` even `doRender` is set to true in the meantime.

Original source