The ajax rendering is not done in the same SiteMap context as the full page
request, so the page-specific snippets are not being accessed.  This is an
interesting problem and deserves a ticket.  I'll capture the current custom
snippet context when ajax requests for a given page are executed.

On Mon, Oct 26, 2009 at 3:39 AM, Jeppe Nejsum Madsen <[email protected]>wrote:

>
> Hi,
>
> I'm using the same rewriting code as in CRUDify, so that URLs like
>
> tender/results/2
>
> show a result page for the tender with id 2. This page contains lots of
> snippets, defined (as in CRUDify) within a SnippetTest partial function.
>
> The page renders fine when hit for the first time. The user can change
> various parameters on the page, causing some of the content on the page
> to change using ajax.
>
> I can't seem to render the content in this ajax call. It doesn't render
> the snippets defined in the snippets partial function, but renders other
> (ie global snippets) ok. This is an example of a select element, that
> should change some content on the page:
>
>    case ("result.name", Full(wp: Result)) => s => Text(wp.name.is)
>    case ("result.select", Full(result: Result)) => {
>      curResult(Full(result));
>      s => {
>        def doSelect(msg: NodeSeq) =
>            ajaxSelectObj(lcs.map(lc => (lc, lc.name.is)), Empty,
>                        lc => {
>                          val nodeseq =
> TemplateFinder.findAnyTemplate(List("result", "results")).open_!
>                          val sub = chooseTemplate("lift",
> "result.result_comparison", nodeseq)
>                          val markup =
> S.session.open_!.processSurroundAndInclude("mypage", sub)
>                          println("processed:"+markup)
>                          SetHtml("mylc", Text(lc.name.is))
>                        })
>
>
>        bind("select", s,
>             "lc1" -> doSelect _,
>             "lc2" -> doSelect _
>        )
>      }
>    }
>
> Here, markup does not contain the contents of the snippet result.name,
> but does contain the results of other, standalone, snippets.
>
> Any clues? Or is there a better way to render partial page content?
>
> /Jeppe
>
> >
>


-- 
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Surf the harmonics

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

Reply via email to