To summaraize.
Loading ajax page via regular request is bad. Because of loosing original page GUID (renderVersion), and will need extra hacks to fix it.
Lift 3.0 also make it impossible to do insisting on top html tag be presented at rendered template.
The good way to go is to load content via Lift ajax call and rendering template with S.runTemplate.
But if partial page contains comets it is also needed to peek up S.cometAtEnd manually at ajax call processing and to add this elements to rendered template (cometAtEnd are snippets and should be rendered before adding)
Also it is needed to update lift_toWatch js variable to add new comets (and to remove old if loaded page replaces page part that contained comets).
Moreover to force new loaded comets to start working immediately after ajax page loading, it is needed to emit a comet response just after lift_toWatch was updated.
It will make client to make a new request according to updated lift_toWatch and to bootstrap new comets at client side.
This part could be easily done with lift roundtrip by calling helper function like this:
def doCallback(data: JValue, func: RoundTripHandlerFunc): Unit = func.done
val jscmd = JsCrVar("ajaxNavCallBack", sess.buildRoundtrip(List[RoundTripInfo](
"cometUpdate" -> doCallback _
))).toJsCmd
That's it.
пятница, 17 мая 2013 г., 20:38:42 UTC+4 пользователь David Pollak написал: