[Lift] Re: How to render ajax response that needs dynamic snippets?

2009-10-26 Thread Jeppe Nejsum Madsen

David Pollak  writes:

> On Mon, Oct 26, 2009 at 9:52 AM, Jeppe Nejsum Madsen wrote:
>
>>
>> David Pollak  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


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Lift] Re: How to render ajax response that needs dynamic snippets?

2009-10-26 Thread David Pollak
On Mon, Oct 26, 2009 at 9:52 AM, Jeppe Nejsum Madsen wrote:

>
> David Pollak  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.


>
> Is there a workaround for this (or perhaps a better way to solve the
> problem :-)
>

If I understand your issue, the best thing to do is capture the special
snippet state in ajax requests.


>
> 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..
>

You won't be the first person to experience this.


>
> /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 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
-~--~~~~--~~--~--~---



[Lift] Re: How to render ajax response that needs dynamic snippets?

2009-10-26 Thread Jeppe Nejsum Madsen

David Pollak  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?

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

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[Lift] Re: How to render ajax response that needs dynamic snippets?

2009-10-26 Thread David Pollak
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 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 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
-~--~~~~--~~--~--~---