[Lift] Re: Nested binding
Jose, please take it from here: http://wiki.github.com/dpp/liftweb/how-to-binding-view-content-to-code Cheers, Heiko 2009/9/14 José María josemariar...@gmail.com Hi, I want to render the content of some tables one after another: table 1 data table 2 data table 3 data I want to separate the XHTML from the code, so I'm trying to use binding. My problem is that each table is rendered with the same XHTML template, as every row. If I use bind to bind the tables: lift:mysnippet.tables /lift:mysnippet.tables What can I do to bind the rows inside this snippet so I can render them? This is what I tried/want/expect: lift:mysnippet.tables table:name/ table:rows? row:name?? /table:rows ? /lift:mysnippet.tables Best regards. -- Heiko Seeberger My job: weiglewilczek.com My blog: heikoseeberger.name Follow me: twitter.com/hseeberger OSGi on Scala: scalamodules.org Lift, the simply functional web framework: liftweb.net --~--~-~--~~~---~--~~ 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: Nested binding
That's what I need Heiko!! But I've another problem, the following code: def estante1 (xhtml : NodeSeq ) : NodeSeq = this.estante(xhtml, Peluches, List(180L,34L,55L) ) def estante (xhtml: NodeSeq, nombre: String, listaProductos : List [Long]) : NodeSeq = { bind(estante, xhtml, nombre -- nombre, productos -- listaProductos.flatMap( id = Producto.find(id) match { case Full(producto) = bind(p, chooseTemplate(producto,datos,xhtml), nombre -- producto.nombre) case _ = NodeSeq.Empty })) } Applied to: lift:estantes.estante1 div class=Estante h3estante:nombre//h3 ul estante:productos producto:datos p:nombre/ /producto:datos /estante:productos /ul /div /lift:estantes.estante1 Generates this xhtml: div class=Estante h3Peluches/h3 ul List( , Peluche de la E. Coli (Escherichi Coli), , , Peluche del Resfriado común (Rhinovirus), , , Peluche de la Sífilis (Treponema pallidum), ) /ul /div Looks like a serialization of the NodeSeq, as if it doesn't concat the nodes. Cheers On Sep 14, 12:48 pm, Heiko Seeberger heiko.seeber...@googlemail.com wrote: Jose, please take it from here:http://wiki.github.com/dpp/liftweb/how-to-binding-view-content-to-code Cheers, Heiko 2009/9/14 José María josemariar...@gmail.com Hi, I want to render the content of some tables one after another: table 1 data table 2 data table 3 data I want to separate the XHTML from the code, so I'm trying to use binding. My problem is that each table is rendered with the same XHTML template, as every row. If I use bind to bind the tables: lift:mysnippet.tables /lift:mysnippet.tables What can I do to bind the rows inside this snippet so I can render them? This is what I tried/want/expect: lift:mysnippet.tables table:name/ table:rows? row:name?? /table:rows ? /lift:mysnippet.tables Best regards. -- Heiko Seeberger My job: weiglewilczek.com My blog: heikoseeberger.name Follow me: twitter.com/hseeberger OSGi on Scala: scalamodules.org Lift, the simply functional web framework: liftweb.net --~--~-~--~~~---~--~~ 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: Nested binding
Jose, Please use - instead of -- The latter is deprecated and seems to do weird things ;-) Cheers, Heiko 2009/9/14 José María josemariar...@gmail.com That's what I need Heiko!! But I've another problem, the following code: def estante1 (xhtml : NodeSeq ) : NodeSeq = this.estante(xhtml, Peluches, List(180L,34L,55L) ) def estante (xhtml: NodeSeq, nombre: String, listaProductos : List [Long]) : NodeSeq = { bind(estante, xhtml, nombre -- nombre, productos -- listaProductos.flatMap( id = Producto.find(id) match { case Full(producto) = bind(p, chooseTemplate(producto,datos,xhtml), nombre -- producto.nombre) case _ = NodeSeq.Empty })) } Applied to: lift:estantes.estante1 div class=Estante h3estante:nombre//h3 ul estante:productos producto:datos p:nombre/ /producto:datos /estante:productos /ul /div /lift:estantes.estante1 Generates this xhtml: div class=Estante h3Peluches/h3 ul List( , Peluche de la E. Coli (Escherichi Coli), , , Peluche del Resfriado común (Rhinovirus), , , Peluche de la Sífilis (Treponema pallidum), ) /ul /div Looks like a serialization of the NodeSeq, as if it doesn't concat the nodes. Cheers On Sep 14, 12:48 pm, Heiko Seeberger heiko.seeber...@googlemail.com wrote: Jose, please take it from here: http://wiki.github.com/dpp/liftweb/how-to-binding-view-content-to-code Cheers, Heiko 2009/9/14 José María josemariar...@gmail.com Hi, I want to render the content of some tables one after another: table 1 data table 2 data table 3 data I want to separate the XHTML from the code, so I'm trying to use binding. My problem is that each table is rendered with the same XHTML template, as every row. If I use bind to bind the tables: lift:mysnippet.tables /lift:mysnippet.tables What can I do to bind the rows inside this snippet so I can render them? This is what I tried/want/expect: lift:mysnippet.tables table:name/ table:rows? row:name?? /table:rows ? /lift:mysnippet.tables Best regards. -- Heiko Seeberger My job: weiglewilczek.com My blog: heikoseeberger.name Follow me: twitter.com/hseeberger OSGi on Scala: scalamodules.org Lift, the simply functional web framework: liftweb.net -- Heiko Seeberger My job: weiglewilczek.com My blog: heikoseeberger.name Follow me: twitter.com/hseeberger OSGi on Scala: scalamodules.org Lift, the simply functional web framework: liftweb.net --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---