Nice!

David Pollak wrote:
> This is nifty... I think it's worthy of inclusion in Lift.  Thanks for 
> the suggestion!
> 
> On Wed, Aug 26, 2009 at 2:44 PM, harryh <har...@gmail.com 
> <mailto:har...@gmail.com>> wrote:
> 
> 
>     Let's say you have a bit of a page like so:
> 
>     <lift:SomeSnippet.section>
>      <foo:name/>
>     <lift:SomeSnippet.section>
> 
>     Now, let's assume that computing whatever is bound to <foo:name/>
>     takes a long time (maybe it takes a network call, or a long database
>     query, or whatever).  You don't want to hold up your entire page view
>     on that so.....
> 
>     <lift:Util.lazyLoad>
>      <lift:SomeSnippet.section>
>        <foo:name/>
>      <lift:SomeSnippet.section>
>     </lift:Util.lazyLoad>
> 
>     Then in your Util snippet:
> 
>     def lazyLoad(xhtml: NodeSeq) = {
>      val id = "lazy"+System.currentTimeMillis()
>      val (name, exp) = ajaxInvoke(() => { SetHtml(id, xhtml) })
>      <div id={id}>
>        <img src="/img/ajax_spinner.gif" height="32" width="32" alt="wait"/
>      >
>        {Script(OnLoad(exp.cmd))}
>      </div>
>     }
> 
>     Feel free to critique if there is a better way of doing this.  It's
>     working pretty good for me so far though.
> 
>     -harryh
> 
> 
> 
> 
> -- 
> Lift, the simply functional web framework http://liftweb.net
> Beginning Scala http://www.apress.com/book/view/1430219890
> Follow me: http://twitter.com/dpp
> Git some: http://github.com/dpp
> 
> > 

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to