p:skeleton use like p:outputPanel

UI Components for JSF
Post Reply
rider
Posts: 497
Joined: 05 Mar 2010, 13:17

18 May 2021, 16:55

Hi,

I would like to use the new p:skeleton.... But only to display this, it make no sense for me...
I would like to use this p:skeleton to open a page, load the content and afterwards show the real content inside the p:skeleton...

How can I do this?
Same, like at facebook etc.

Thanks
Primefaces 12.0, WildFly 21

Melloware
Posts: 3717
Joined: 22 Apr 2013, 15:48

18 May 2021, 22:10

Yep load your page with Skeleton

then with Jquery OnLoad JavaScript call a p:remoteCommand to do an AJAX update and set the skeleton rendered="false" and your real panel rendered="true". So your page will load with the skeleton while in the background AJAX load and replace the panel. That's pretty much what Facebook and others do.
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1

jepsar
Posts: 166
Joined: 03 Sep 2014, 11:41
Location: NL / BE
Contact:

22 Nov 2021, 14:47

This is now supported in p:outputPanel:

Code: Select all

<p:outputPanel deferred="true">
    <p:ajax event="load" listener="#{bean.loadData}"/>
    <f:facet name="loading">
        <p:skeleton width="200px" height="21px" class="p-mb-4"/>
        <p:skeleton width="100%" height="63px"/>
    </f:facet>
    <h5>#{bean.data.title}</h5>
    <p>#{bean.data.body}</p>
</p:outputPanel>
https://primefaces.github.io/primefaces ... ding-facet

https://www.primefaces.org/showcase/ui/ ... anel.xhtml
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub: https://github.com/jepsar
Spotify: 90s Rave, Acid, Trance, House

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 66 guests