updating a panel that has rendered="false" doesn't always work

UI Components for JSF
Post Reply
schlebe
Posts: 212
Joined: 25 Sep 2015, 13:32
Location: Colmar-Berg (Luxembourg)

12 Jan 2018, 13:26

Hello, currently, I will update a <p:panel> that has "rendered" attribute setted to "false" like this.

Code: Select all

<p:commandButton 
    value="COPY-GRADE"
    style="font-size: 20px"
    actionListener="#{viewController.loadCopyGradeList()}"
    update="HeaderForm:CopyGradePanel"
    />
The updated Panel html code was

Code: Select all

<p:panel id="CopyGradePanel" rendered="#{viewController.getDisplayCopyGradePanel()}">
    <p:dataTable>
On Primefaces 6.1.1, when I test my code, the #{viewController.loadCopyGradeList()} function and the #{viewController.getDisplayCopyGradePanel()} functions are well called BUT the panel is not displayed (or visible) !!!

I have a little searched and I have found that when a container (not only a Panel) is not rendered it cannot be updated !

The following code work well for me

Code: Select all

<p:panel id="CopyGradePanel" >
    <p:dataTable rendered="#{viewController.getDisplayCopyGradePanel()}">
The only problem with this code is that <p:panel> has a border and it height is not 0 !

I have then searched in Primefaces PDF documentation and found some explanations for using <p:outputPanel>

Now I use the following code

Code: Select all

<p:outputPanel id="CopyGradePanel" >
    <p:dataTable rendered="#{viewController.getDisplayCopyGradePanel()}">
When I compare 6.1 documentation and 6.0 documentation I see that in 6.0 documentation, this outputPanel feature/tips is not explained.

My question is:

In which Primefaces version has this tricky feature be added ?

This question would be interesting for me because, if the response is "since 6.1", I need to review all the update="" of unrendered widget !
PrimeFaces 6.2.4
Mojarra 2.2.13
Glassfish 4.1

tandraschko
PrimeFaces Core Developer
Posts: 3979
Joined: 03 Dec 2010, 14:11
Location: Bavaria, DE
Contact:

12 Jan 2018, 13:36

Updates on initial un-rendered components should never work.
Therefore it's required to wrap the unredered component in a container, that is always visible.
This container should be updated instead.

Known pattern. Everything else is a random bug somewhere. Maybe you also updated a container (like the @form) in the past.
Thomas Andraschko

PrimeFaces | PrimeFaces Extensions

Apache Member | OpenWebBeans, DeltaSpike, MyFaces, BVal, TomEE

Sponsor me: https://github.com/sponsors/tandraschko
Blog: http://tandraschko.blogspot.de/
Twitter: https://twitter.com/TAndraschko

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 22 guests