0

From this answer I got that:

You can only ajax-update a component which is always rendered (i.e. when it does not have a rendered attribute).

But I tried this code and ajax-update doesn't work for me, I need to refresh the browser to see the changed button. What am I doing wrong?

<p:outputPanel id="buttonArea">
    <p:panel styleClass="button-area" 
             rendered="#{user != null and loginManager.profile.id != userPage.profile.id}">
        <h:form>
             <p:commandButton styleClass="button-flat" action="#{userPage.followUser}"
                              value="Follow" rendered="#{!userPage.followed}" update="buttonArea"/>
             <p:commandButton styleClass="button-flat" action="#{userPage.unfollowUser}"
                              value="Unfollow" rendered="#{userPage.followed}" update="buttonArea"/>
        </h:form>
    </p:panel>
</p:outputPanel>

Edit:

I tried the solution from the possible duplicated question and it doesn't work either for me, I'm doing something wrong that it's not explained there, I tried with the ajax tag, the id in html is exactly 'buttonArea' but I even tried with and without colon when I reference the id, I tried with fragments...

Community
  • 1
  • 1
Kronen
  • 369
  • 9
  • 23

1 Answers1

-2

Your commandButtons need their own ids. Update them instead of the panel.

Dennis
  • 186
  • 2
  • 9