Is there a way to reload a LazyLoad snippet?

22 views
Skip to first unread message

David Marí

unread,
Sep 12, 2015, 2:25:37 AM9/12/15
to Lift
Hi,

I'm lazily loading some content and for a specific snippet I would like to enable it to be reloaded, either every certain time or by clicking some button (I guess it's irrelevant how to trigger the reload).

I don't seem to be able to find any references on how to do this. If possible, which would be the way to do it?

Would it make sense to wrap the HTML in another snippet similar to LazyLoad that would somehow capture the JsCmd and enable rerunning it? Is that even possible?

Still through the learning paths of Lift, so sorry if I missed something...

Thanks,
David.

Brett Grace

unread,
Sep 12, 2015, 3:34:14 PM9/12/15
to Lift
You can use idMemoize to capture as a an object the chunk of template and the CssSel that you're using to transform it. You can then call its setHtml method when you need it to re-render. There was a question about it a few weeks ago that I answered where I put up some sample code, here: https://groups.google.com/forum/#!topic/liftweb/omJGmIgSwNQ

I'm not sure how well it plays with the LazyLoad "spinner" though.

David Marí

unread,
Sep 13, 2015, 2:16:51 AM9/13/15
to lif...@googlegroups.com
Thank you so much, it worked pretty easily :)

Regarding the spinner, as this is ajax and not comet, it just goes through the LiftRules.ajaxStart ... LiftRules.ajaxEnd path. 

--
David Marí

El 12/09/2015, a les 21:34, Brett Grace <bgr...@mac.com> va escriure:

--
--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code

---
You received this message because you are subscribed to the Google Groups "Lift" group.
To unsubscribe from this group and stop receiving emails from it, send an email to liftweb+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

David Marí

unread,
Sep 13, 2015, 2:17:56 AM9/13/15
to lif...@googlegroups.com
Oh, and by the way, I could remove the LazyLoad, which I put only thinking that I’d need the snippet to somehow be “dynamic”.

Thanks again,

--
David Marí

El 13/09/2015, a les 8:16, David Marí <dap...@gmail.com> va escriure:
Reply all
Reply to author
Forward
0 new messages