Personally I don't have much time for it now but could you please open a defect here?: http://github.com/dpp/liftweb/issues
Br's, Marius On Dec 24, 10:25 am, Adam Warski <[email protected]> wrote: > Heh, of course :) > Can you (or somebody else) fix Listing 12 in the tutorial then? > > Adam > > On Dec 23, 2009, at 11:19 PM, Marius wrote: > > > Why not something like: > > > <div id="all_todos"> > > <lift:TD.list all_id="all_todos"> > > ... > > </lift:TD.list> > > </div> > > > Br's, > > Marius > > > On Dec 23, 11:46 pm, Adam Warski <[email protected]> wrote: > >> Hello, > > >> just a note to the snippets written in the tutorial. The elements of the > >> todo list, when changed (e.g. the "done" checkbox), submit and redraw the > >> list. The code for that is (Listing 17): > > >> def list(html: NodeSeq) = { > >> val id = S.attr("all_id").open_! > > >> def inner(): NodeSeq = { > >> def reDraw() = SetHtml(id, inner()) > > >> bind("todo", html, > >> "exclude" -> > >> ajaxCheckbox(QueryNotDone, v => {QueryNotDone(v); reDraw}), > >> "list" -> doList(reDraw) _) > >> } > > >> inner() > > >> } > > >> And the corresponding template: > > >> <lift:TD.list all_id="all_todos"> > >> <div id="all_todos"> > >> <!-- proper list --> > >> </div> > >> </lift:TD.list> > > >> As SetHtml sets the children of the element with the specified id, after > >> one change of the checkbox and one ajax call, there will be a <div > >> id="all_todos"> inside the original <div id="all_todos"> (as we set the > >> children of the original element to be the nodes passed to the snippet). > >> So you end up with: > > >> <lift:TD.list all_id="all_todos"> > >> <div id="all_todos"> > >> <div id="all_todos"> > >> <!-- proper list --> > >> </div> > >> </div> > >> </lift:TD.list> > > >> Subsequent calls don't produce any more divs, as the children of the first > >> div with id "all_todos" get replaced. However, I think it's not too > >> "clean" to produce markup like that. > >> The solution I think would be to (somehow) strip the outer div of the html > >> NodeSeq and use that in the ajax reDraw method, instead of capturing the > >> original html with a closure. > >> But probably Lift gurus have a better solution :). > > >> -- > >> 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 > > athttp://groups.google.com/group/liftweb?hl=en. -- 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.
