Wang Sheng
Wang Sheng

Reputation: 780

Primefaces selectors not updating a panelGroup

I am trying Primefaces selectors and it appears that it couldn't update an panelGroup.

<h:panelGroup layout="block" styleClass="updateMe">
    <h:outputText value="#{bean.value}"/>
</h:panelGroup>
<h:form>
    <h:inputText value="#{bean.value}"/>
    <h:commandButton value="submit">
        <p:ajax process="@form" update="@(.updateMe)" oncomplete="alert(1)"/>
    </h:commandButton>
</h:form>

In this case the panelGroup never gets updated. But if I change the panelGroup to <p:outputPanel>, then it worked fine.

Observing the generated HTML, the only difference is that the <span> generated by panelGroup doesn't have an id while the one generated by outputPanel has an id. Could this be the reason why the first one is not getting updated (cos jQuery selector couldn't find the component id?)

If that is the case, is there any other component that does not have any ids and should be avoided when using Primefaces selectors?

Upvotes: 2

Views: 4306

Answers (1)

partlov
partlov

Reputation: 14277

When using Primefaces selector jQuery is used to select components on client side, and discover their client ids. When AJAX is sent one of parameters that is sent is javax.faces.partial.render whose value are client ids of components which should be updated. If component doesn't have client id it can't be updated directly, you can update parent component for example. Provide id attribute for panelGroup and try to update it with Primefaces selector.

Upvotes: 4

Related Questions