With SetHtml you just provide the parent element ID and the NodeSeq
you want to render as a child of that parent. You're saying you don;t
have the NodeSeq Corresponding to the List but I assume you do have
the list right? So assume this Ajax function:
def myCallback(): JsCmd = {
val myList = ...
val html: NodeSeq = myList.flatMap(e => <td>{e toString}</td>)
SetHtml("all_todos", html)
}
and then in your markup you can just have:
<div id="all_todos"></div>
If you were referring to something else, please provide more details.
Br's,
Marius
On Dec 23, 10:32 am, Adam Warski <[email protected]> wrote:
> Hello,
>
> I'm just starting with Lift, and there's one thing I can't figure out. I want
> to modify the ToDo example from the tutorial so that the "Add" button makes
> an ajax call, adds the element to a list and displays the modified result.
>
> The problem is that I don't know how to redraw the list after the button has
> been pressed. More generally: how to redraw a page fragment with ajax? I
> could do that with SetHtml if I had the NodeSeq corresponding to the list,
> but the button is in an "unrelated" page fragment so it doesn't have it.
> What's the Lift way to solve such problems?
>
> The page roughly is:
>
> <lift:TD.add form="post">
> <!-- fields an submit button bound here -->
> </lift:TD.add>
>
> <!-- some other code -->
>
> <!-- the list that I want to redraw -->
> <lift:TD.list all_id="all_todos">
> ...
> </lift:TD.list>
>
> I was looking through the list archive but didn't find anything. Sorry if
> it's a repeated question :)
>
> --
> Adam
--
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.