Vega
Vega

Reputation: 504

p:overlayPanel does not show the content

<h:form>
    <p:dialog>
        <p:outputPanel>
            <p:panelGrid>
                <p:row>
                    <p:column>
                        <p:commandLink value="link" id="myLink"/>
                        <p:overlayPanel  id="overPanel" for="myLink" >
                            <p:outputLabel id="linkPanel" value="#{bean.value}"/>
                        </p:overlayPanel>
                    </p:column>
                </p:row>
            </p:panelGrid>
        </p:outputPanel>
    </p:dialog>
</h:form>

In the above snippet overlay panel does not show the content, only an empty panel shown, but if I replace the value with the hardcoded one like value="test", I can see the content in the overlay panel, when I inspect the page with firebug I can see the content is not placed inside the div of overlay panel. Can someone help on this?

Upvotes: 1

Views: 3029

Answers (2)

Kishor Prakash
Kishor Prakash

Reputation: 8151

Making your p:overlayPanel Lazy Load might solve the problem. You can achive it by using dynamic="true" on your p:overlayPanel.

This technique makes your p:overlayPanel's contents to not render on page load itself, render just before p:overlayPanel is shown.

One more way is to update your p:outputLabel from the p:commandLink.

Yet another way is to use the client side js function loadContents() on your p:overlayPanel's widgetwar. Since you are keeping your overlay inside datatable this might not be a feasible solution.

Upvotes: 1

Yacine Ben Slimene
Yacine Ben Slimene

Reputation: 135

Try using toString() like this :

<p:outputLabel id="linkPanel" value="#{bean.value.toString()}" />

i had the same error this solved it. And try to make sure you have the method toString overriden inside your bean .

Upvotes: 0

Related Questions