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
> 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.
Do you want me to create a ticket or?
Is there a workaround for this (or perhaps a better way to solve the
problem :-)
I guess I can always extract the body of the snippet into a method and
just invoke this from the ajax call as well as the snippet......
/Jeppe
Do you want me to create a ticket or?
David Pollak <feeder.of...@gmail.com> writes:
> 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.
Is there a workaround for this (or perhaps a better way to solve the
problem :-)
I guess I can always extract the body of the snippet into a method and
just invoke this from the ajax call as well as the snippet......
/Jeppe
> On Mon, Oct 26, 2009 at 9:52 AM, Jeppe Nejsum Madsen <je...@ingolfs.dk>wrote:
>
>>
>> David Pollak <feeder.of...@gmail.com> writes:
>>
>> > 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.
>>
>> Do you want me to create a ticket or?
>>
>
> Yes.
Done. http://github.com/dpp/liftweb/issues/#issue/134
/Jeppe