[Lift] Re: Snippet question
Hm, i saw a method with attrs, but it was private. guess i overlooked it. thanks. On 21 Jan., 22:46, Ross Mellgren wrote: > The signature of ajaxText is: > > def ajaxText(value : String, func : (String) => JsCmd, attrs : (String, > String)*): Elem > def ajaxText(value : String, jsFunc : Call, func : (String) => JsCmd, attrs : > (String, String)*): Elem > > The attrs vararg is for this purpose, just pass in additional attributes you > want there. Note that you should not pass the "name" attribute, as that is > generated by Lift. > > -Ross > > On Jan 21, 2010, at 4:43 PM, Franz Bettag wrote: > > > One last question, is there any way to give an ajaxText some kind of > > style/class/id attribute? I looked at the source but it was really > > hard to get the hang of it. > > > best regards. > > > On 21 Jan., 02:05, Franz Bettag wrote: > >> Ah, i was already wondering if that was a typo or what it does =) > >> thank you very much. > > >> The project is coming along nicely. You really notice the performance > >> difference between our old one (ruby based) and scala. Lift delivery > >> the list of all subnets in 2.6 seconds. Merb needed almost 8 seconds > >> for the same request. > > >> I must admit that the merb project used amqp to collect remote data > >> and i use akka now, but the performance boost is kinda incredible. > >> Also on the merb-implementation, i had most of the rendering done by > >> JS since rendering everything with ruby slowed down everything for > >> another few seconds, on lift it works even faster on the client side > >> since it already does the output-generation in a nip of a second. > > >> Kudos! > > >> On 21 Jan., 01:24, Ross Mellgren wrote: > > >>> Use & to combine JsCmd. e.g. > > >>> JsShowId("ajax-spinner") & SetHtml("subnet-1234", my awesome subnet > >>> contents) > > >>> -Ross > > >>> On Jan 20, 2010, at 7:16 PM, Franz Bettag wrote: > > Works like a charm now! Thanks! > > One last question tho, is it possible to get a client-Side-callback > for net.liftweb.http.SHtml.a? > I want to start showing a specific ajax spinner (have more than one on > the page) upon pressing a special link. > > I don't get how i might "chain" them together. :) > > On 20 Jan., 22:15, Franz Bettag wrote: > > Of course i forgot to paste the snippet..http://pastie.org/787160 > > > On 20 Jan., 21:44, Ross Mellgren wrote: > > >> Scala can't figure out what type of parameter you mean, so you need to > >> annotate it -- "expand" -> (fooXhtml: NodeSeq) => {... } > > >> Or use a separately named function with a type signature, e.g. > > >> def doTheStuff(ns: NodeSeq): NodeSeq) = { Log.error(ns.toStrnig); > >> } > > >> bind(..., "expand" -> doTheStuff _) > > >> -Ross > > >> On Jan 20, 2010, at 3:41 PM, Franz Bettag wrote: > > >>> "expand" -> (fooXhtml) => { Log.error(fooXhtml.toString); }, > > >>> error: not a legal formal parameter (pointing at the => ) > > >>> On 20 Jan., 21:32, greekscala wrote: > Hello, > > yes a function that takes NodeSeq parameter and returns > a NodeSeq :) > > "foo" -> (ns) => {function body} or > "foo" -> theCalledFunction > > best regards > > On 20 Jan., 21:26, Franz Bettag wrote: > > > How would that look like? > > "foo" => nodeSeqMethod _ ? > > > On 20 Jan., 21:21, Naftoli Gugenheim wrote: > > >> Meaning to the right of the -> arrow. > > >> - > > >> Franz Bettag wrote: > > >> Ah figured it out. Played long enough around to get the right way: > > >> () => {expand(trafficReply.subnet)} > > >> Another question though, would it be possible to use > >> and pass > >> the > >> given NodeSeq over the bind into a function? > > >> On 20 Jan., 19:08, Franz Bettag wrote: > > >>> Sorry if i am asking a lot of questions lately, but i am trying > >>> to get > >>> this project of mine working so i can write about the specific > >>> problems i ran into and how they got done. > > >>> def subnets(xhtml: NodeSeq): NodeSeq = { > >>> val content = IPnet.findAll(OrderBy(IPnet.name, > >>> Ascending)).map(ip > >>> => { > > >>> /* Bind the xml */ > >>> bind("ip", xhtml, > >>> "subnet" -> > >>> Text(ip.name.toString), > >>> "action" -> > >>> SHtml.a(expand(ip.subnet) _, "See all IPs") > >>> ) > >>> }).mkString > > >>> XML.loadString("%s".format(content)) > >>> } > > >>> def expand(subnet: String): JsCmd = { > >>> Log.info("
Re: [Lift] Re: Snippet question
The signature of ajaxText is: def ajaxText(value : String, func : (String) => JsCmd, attrs : (String, String)*): Elem def ajaxText(value : String, jsFunc : Call, func : (String) => JsCmd, attrs : (String, String)*): Elem The attrs vararg is for this purpose, just pass in additional attributes you want there. Note that you should not pass the "name" attribute, as that is generated by Lift. -Ross On Jan 21, 2010, at 4:43 PM, Franz Bettag wrote: > One last question, is there any way to give an ajaxText some kind of > style/class/id attribute? I looked at the source but it was really > hard to get the hang of it. > > best regards. > > On 21 Jan., 02:05, Franz Bettag wrote: >> Ah, i was already wondering if that was a typo or what it does =) >> thank you very much. >> >> The project is coming along nicely. You really notice the performance >> difference between our old one (ruby based) and scala. Lift delivery >> the list of all subnets in 2.6 seconds. Merb needed almost 8 seconds >> for the same request. >> >> I must admit that the merb project used amqp to collect remote data >> and i use akka now, but the performance boost is kinda incredible. >> Also on the merb-implementation, i had most of the rendering done by >> JS since rendering everything with ruby slowed down everything for >> another few seconds, on lift it works even faster on the client side >> since it already does the output-generation in a nip of a second. >> >> Kudos! >> >> On 21 Jan., 01:24, Ross Mellgren wrote: >> >>> Use & to combine JsCmd. e.g. >> >>> JsShowId("ajax-spinner") & SetHtml("subnet-1234", my awesome subnet >>> contents) >> >>> -Ross >> >>> On Jan 20, 2010, at 7:16 PM, Franz Bettag wrote: >> Works like a charm now! Thanks! >> One last question tho, is it possible to get a client-Side-callback for net.liftweb.http.SHtml.a? I want to start showing a specific ajax spinner (have more than one on the page) upon pressing a special link. >> I don't get how i might "chain" them together. :) >> On 20 Jan., 22:15, Franz Bettag wrote: > Of course i forgot to paste the snippet..http://pastie.org/787160 >> > On 20 Jan., 21:44, Ross Mellgren wrote: >> >> Scala can't figure out what type of parameter you mean, so you need to >> annotate it -- "expand" -> (fooXhtml: NodeSeq) => {... } >> >> Or use a separately named function with a type signature, e.g. >> >> def doTheStuff(ns: NodeSeq): NodeSeq) = { Log.error(ns.toStrnig); > /> } >> >> bind(..., "expand" -> doTheStuff _) >> >> -Ross >> >> On Jan 20, 2010, at 3:41 PM, Franz Bettag wrote: >> >>> "expand" -> (fooXhtml) => { Log.error(fooXhtml.toString); }, >> >>> error: not a legal formal parameter (pointing at the => ) >> >>> On 20 Jan., 21:32, greekscala wrote: Hello, >> yes a function that takes NodeSeq parameter and returns a NodeSeq :) >> "foo" -> (ns) => {function body} or "foo" -> theCalledFunction >> best regards >> On 20 Jan., 21:26, Franz Bettag wrote: >> > How would that look like? > "foo" => nodeSeqMethod _ ? >> > On 20 Jan., 21:21, Naftoli Gugenheim wrote: >> >> Meaning to the right of the -> arrow. >> >> - >> >> Franz Bettag wrote: >> >> Ah figured it out. Played long enough around to get the right way: >> >> () => {expand(trafficReply.subnet)} >> >> Another question though, would it be possible to use >> and pass the >> given NodeSeq over the bind into a function? >> >> On 20 Jan., 19:08, Franz Bettag wrote: >> >>> Sorry if i am asking a lot of questions lately, but i am trying to >>> get >>> this project of mine working so i can write about the specific >>> problems i ran into and how they got done. >> >>> def subnets(xhtml: NodeSeq): NodeSeq = { >>> val content = IPnet.findAll(OrderBy(IPnet.name, >>> Ascending)).map(ip >>> => { >> >>> /* Bind the xml */ >>> bind("ip", xhtml, >>> "subnet" -> Text(ip.name.toString), >>> "action" -> >>> SHtml.a(expand(ip.subnet) _, "See all IPs") >>> ) >>> }).mkString >> >>> XML.loadString("%s".format(content)) >>> } >> >>> def expand(subnet: String): JsCmd = { >>> Log.info("Requested subnet %s".format(subnet)) >>> Alert("subnet %s was requested".format(subnet)) >>> } >> >>> The Problem is the "action" that gets binded. I don't get how i have >>> to use SHtml.a to pass a va
[Lift] Re: Snippet question
One last question, is there any way to give an ajaxText some kind of style/class/id attribute? I looked at the source but it was really hard to get the hang of it. best regards. On 21 Jan., 02:05, Franz Bettag wrote: > Ah, i was already wondering if that was a typo or what it does =) > thank you very much. > > The project is coming along nicely. You really notice the performance > difference between our old one (ruby based) and scala. Lift delivery > the list of all subnets in 2.6 seconds. Merb needed almost 8 seconds > for the same request. > > I must admit that the merb project used amqp to collect remote data > and i use akka now, but the performance boost is kinda incredible. > Also on the merb-implementation, i had most of the rendering done by > JS since rendering everything with ruby slowed down everything for > another few seconds, on lift it works even faster on the client side > since it already does the output-generation in a nip of a second. > > Kudos! > > On 21 Jan., 01:24, Ross Mellgren wrote: > > > Use & to combine JsCmd. e.g. > > > JsShowId("ajax-spinner") & SetHtml("subnet-1234", my awesome subnet > > contents) > > > -Ross > > > On Jan 20, 2010, at 7:16 PM, Franz Bettag wrote: > > > > Works like a charm now! Thanks! > > > > One last question tho, is it possible to get a client-Side-callback > > > for net.liftweb.http.SHtml.a? > > > I want to start showing a specific ajax spinner (have more than one on > > > the page) upon pressing a special link. > > > > I don't get how i might "chain" them together. :) > > > > On 20 Jan., 22:15, Franz Bettag wrote: > > >> Of course i forgot to paste the snippet..http://pastie.org/787160 > > > >> On 20 Jan., 21:44, Ross Mellgren wrote: > > > >>> Scala can't figure out what type of parameter you mean, so you need to > > >>> annotate it -- "expand" -> (fooXhtml: NodeSeq) => {... } > > > >>> Or use a separately named function with a type signature, e.g. > > > >>> def doTheStuff(ns: NodeSeq): NodeSeq) = { Log.error(ns.toStrnig); > >>> /> } > > > >>> bind(..., "expand" -> doTheStuff _) > > > >>> -Ross > > > >>> On Jan 20, 2010, at 3:41 PM, Franz Bettag wrote: > > > "expand" -> (fooXhtml) => { Log.error(fooXhtml.toString); }, > > > error: not a legal formal parameter (pointing at the => ) > > > On 20 Jan., 21:32, greekscala wrote: > > > Hello, > > > > yes a function that takes NodeSeq parameter and returns > > > a NodeSeq :) > > > > "foo" -> (ns) => {function body} or > > > "foo" -> theCalledFunction > > > > best regards > > > > On 20 Jan., 21:26, Franz Bettag wrote: > > > >> How would that look like? > > >> "foo" => nodeSeqMethod _ ? > > > >> On 20 Jan., 21:21, Naftoli Gugenheim wrote: > > > >>> Meaning to the right of the -> arrow. > > > >>> - > > > >>> Franz Bettag wrote: > > > >>> Ah figured it out. Played long enough around to get the right way: > > > >>> () => {expand(trafficReply.subnet)} > > > >>> Another question though, would it be possible to use > > >>> and pass > > >>> the > > >>> given NodeSeq over the bind into a function? > > > >>> On 20 Jan., 19:08, Franz Bettag wrote: > > > Sorry if i am asking a lot of questions lately, but i am trying to > > get > > this project of mine working so i can write about the specific > > problems i ran into and how they got done. > > > def subnets(xhtml: NodeSeq): NodeSeq = { > > val content = IPnet.findAll(OrderBy(IPnet.name, > > Ascending)).map(ip > > => { > > > /* Bind the xml */ > > bind("ip", xhtml, > > "subnet" -> Text(ip.name.toString), > > "action" -> > > SHtml.a(expand(ip.subnet) _, "See all IPs") > > ) > > }).mkString > > > XML.loadString("%s".format(content)) > > } > > > def expand(subnet: String): JsCmd = { > > Log.info("Requested subnet %s".format(subnet)) > > Alert("subnet %s was requested".format(subnet)) > > } > > > The Problem is the "action" that gets binded. I don't get how i > > have > > to use SHtml.a to pass a value to the called function. Any hints? > > > Thank you very much in advance > > > >>> -- > > >>> You received this message because you are subscribed to the Google > > >>> Groups "Lift" group. > > >>> To post to this group, send email to lift...@googlegroups.com. > > >>> To unsubscribe from this group, send email to > > >>> liftweb+unsubscr...@googlegroups.com. > > >>> For more options, visit this group > > >>> athttp://groups.goo
[Lift] Re: Snippet question
Ah, i was already wondering if that was a typo or what it does =) thank you very much. The project is coming along nicely. You really notice the performance difference between our old one (ruby based) and scala. Lift delivery the list of all subnets in 2.6 seconds. Merb needed almost 8 seconds for the same request. I must admit that the merb project used amqp to collect remote data and i use akka now, but the performance boost is kinda incredible. Also on the merb-implementation, i had most of the rendering done by JS since rendering everything with ruby slowed down everything for another few seconds, on lift it works even faster on the client side since it already does the output-generation in a nip of a second. Kudos! On 21 Jan., 01:24, Ross Mellgren wrote: > Use & to combine JsCmd. e.g. > > JsShowId("ajax-spinner") & SetHtml("subnet-1234", my awesome subnet > contents) > > -Ross > > On Jan 20, 2010, at 7:16 PM, Franz Bettag wrote: > > > Works like a charm now! Thanks! > > > One last question tho, is it possible to get a client-Side-callback > > for net.liftweb.http.SHtml.a? > > I want to start showing a specific ajax spinner (have more than one on > > the page) upon pressing a special link. > > > I don't get how i might "chain" them together. :) > > > On 20 Jan., 22:15, Franz Bettag wrote: > >> Of course i forgot to paste the snippet..http://pastie.org/787160 > > >> On 20 Jan., 21:44, Ross Mellgren wrote: > > >>> Scala can't figure out what type of parameter you mean, so you need to > >>> annotate it -- "expand" -> (fooXhtml: NodeSeq) => {... } > > >>> Or use a separately named function with a type signature, e.g. > > >>> def doTheStuff(ns: NodeSeq): NodeSeq) = { Log.error(ns.toStrnig); >>> /> } > > >>> bind(..., "expand" -> doTheStuff _) > > >>> -Ross > > >>> On Jan 20, 2010, at 3:41 PM, Franz Bettag wrote: > > "expand" -> (fooXhtml) => { Log.error(fooXhtml.toString); }, > > error: not a legal formal parameter (pointing at the => ) > > On 20 Jan., 21:32, greekscala wrote: > > Hello, > > > yes a function that takes NodeSeq parameter and returns > > a NodeSeq :) > > > "foo" -> (ns) => {function body} or > > "foo" -> theCalledFunction > > > best regards > > > On 20 Jan., 21:26, Franz Bettag wrote: > > >> How would that look like? > >> "foo" => nodeSeqMethod _ ? > > >> On 20 Jan., 21:21, Naftoli Gugenheim wrote: > > >>> Meaning to the right of the -> arrow. > > >>> - > > >>> Franz Bettag wrote: > > >>> Ah figured it out. Played long enough around to get the right way: > > >>> () => {expand(trafficReply.subnet)} > > >>> Another question though, would it be possible to use > >>> and pass the > >>> given NodeSeq over the bind into a function? > > >>> On 20 Jan., 19:08, Franz Bettag wrote: > > Sorry if i am asking a lot of questions lately, but i am trying to > get > this project of mine working so i can write about the specific > problems i ran into and how they got done. > > def subnets(xhtml: NodeSeq): NodeSeq = { > val content = IPnet.findAll(OrderBy(IPnet.name, > Ascending)).map(ip > => { > > /* Bind the xml */ > bind("ip", xhtml, > "subnet" -> Text(ip.name.toString), > "action" -> > SHtml.a(expand(ip.subnet) _, "See all IPs") > ) > }).mkString > > XML.loadString("%s".format(content)) > } > > def expand(subnet: String): JsCmd = { > Log.info("Requested subnet %s".format(subnet)) > Alert("subnet %s was requested".format(subnet)) > } > > The Problem is the "action" that gets binded. I don't get how i have > to use SHtml.a to pass a value to the called function. Any hints? > > Thank you very much in advance > > >>> -- > >>> You received this message because you are subscribed to the Google > >>> Groups "Lift" group. > >>> To post to this group, send email to lift...@googlegroups.com. > >>> To unsubscribe from this group, send email to > >>> liftweb+unsubscr...@googlegroups.com. > >>> 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 lift...@googlegroups.com. > To unsubscribe from this group, send email to > liftweb+unsubscr...@googlegroups.com. > For more options, visit this group > athttp://groups.google.com/group/liftweb?hl=en. > > -- > > You received
Re: [Lift] Re: Snippet question
Use & to combine JsCmd. e.g. JsShowId("ajax-spinner") & SetHtml("subnet-1234", my awesome subnet contents) -Ross On Jan 20, 2010, at 7:16 PM, Franz Bettag wrote: > Works like a charm now! Thanks! > > One last question tho, is it possible to get a client-Side-callback > for net.liftweb.http.SHtml.a? > I want to start showing a specific ajax spinner (have more than one on > the page) upon pressing a special link. > > I don't get how i might "chain" them together. :) > > On 20 Jan., 22:15, Franz Bettag wrote: >> Of course i forgot to paste the snippet..http://pastie.org/787160 >> >> On 20 Jan., 21:44, Ross Mellgren wrote: >> >>> Scala can't figure out what type of parameter you mean, so you need to >>> annotate it -- "expand" -> (fooXhtml: NodeSeq) => {... } >> >>> Or use a separately named function with a type signature, e.g. >> >>> def doTheStuff(ns: NodeSeq): NodeSeq) = { Log.error(ns.toStrnig); } >> >>> bind(..., "expand" -> doTheStuff _) >> >>> -Ross >> >>> On Jan 20, 2010, at 3:41 PM, Franz Bettag wrote: >> "expand" -> (fooXhtml) => { Log.error(fooXhtml.toString); }, >> error: not a legal formal parameter (pointing at the => ) >> On 20 Jan., 21:32, greekscala wrote: > Hello, >> > yes a function that takes NodeSeq parameter and returns > a NodeSeq :) >> > "foo" -> (ns) => {function body} or > "foo" -> theCalledFunction >> > best regards >> > On 20 Jan., 21:26, Franz Bettag wrote: >> >> How would that look like? >> "foo" => nodeSeqMethod _ ? >> >> On 20 Jan., 21:21, Naftoli Gugenheim wrote: >> >>> Meaning to the right of the -> arrow. >> >>> - >> >>> Franz Bettag wrote: >> >>> Ah figured it out. Played long enough around to get the right way: >> >>> () => {expand(trafficReply.subnet)} >> >>> Another question though, would it be possible to use >>> and pass the >>> given NodeSeq over the bind into a function? >> >>> On 20 Jan., 19:08, Franz Bettag wrote: >> Sorry if i am asking a lot of questions lately, but i am trying to get this project of mine working so i can write about the specific problems i ran into and how they got done. >> def subnets(xhtml: NodeSeq): NodeSeq = { val content = IPnet.findAll(OrderBy(IPnet.name, Ascending)).map(ip => { >> /* Bind the xml */ bind("ip", xhtml, "subnet" -> Text(ip.name.toString), "action" -> SHtml.a(expand(ip.subnet) _, "See all IPs") ) }).mkString >> XML.loadString("%s".format(content)) } >> def expand(subnet: String): JsCmd = { Log.info("Requested subnet %s".format(subnet)) Alert("subnet %s was requested".format(subnet)) } >> The Problem is the "action" that gets binded. I don't get how i have to use SHtml.a to pass a value to the called function. Any hints? >> Thank you very much in advance >> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Lift" group. >>> To post to this group, send email to lift...@googlegroups.com. >>> To unsubscribe from this group, send email to >>> liftweb+unsubscr...@googlegroups.com. >>> 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 lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. 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 lift...@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. > > -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@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: Snippet question
Works like a charm now! Thanks! One last question tho, is it possible to get a client-Side-callback for net.liftweb.http.SHtml.a? I want to start showing a specific ajax spinner (have more than one on the page) upon pressing a special link. I don't get how i might "chain" them together. :) On 20 Jan., 22:15, Franz Bettag wrote: > Of course i forgot to paste the snippet..http://pastie.org/787160 > > On 20 Jan., 21:44, Ross Mellgren wrote: > > > Scala can't figure out what type of parameter you mean, so you need to > > annotate it -- "expand" -> (fooXhtml: NodeSeq) => {... } > > > Or use a separately named function with a type signature, e.g. > > > def doTheStuff(ns: NodeSeq): NodeSeq) = { Log.error(ns.toStrnig); } > > > bind(..., "expand" -> doTheStuff _) > > > -Ross > > > On Jan 20, 2010, at 3:41 PM, Franz Bettag wrote: > > > > "expand" -> (fooXhtml) => { Log.error(fooXhtml.toString); }, > > > > error: not a legal formal parameter (pointing at the => ) > > > > On 20 Jan., 21:32, greekscala wrote: > > >> Hello, > > > >> yes a function that takes NodeSeq parameter and returns > > >> a NodeSeq :) > > > >> "foo" -> (ns) => {function body} or > > >> "foo" -> theCalledFunction > > > >> best regards > > > >> On 20 Jan., 21:26, Franz Bettag wrote: > > > >>> How would that look like? > > >>> "foo" => nodeSeqMethod _ ? > > > >>> On 20 Jan., 21:21, Naftoli Gugenheim wrote: > > > Meaning to the right of the -> arrow. > > > - > > > Franz Bettag wrote: > > > Ah figured it out. Played long enough around to get the right way: > > > () => {expand(trafficReply.subnet)} > > > Another question though, would it be possible to use > > and pass the > > given NodeSeq over the bind into a function? > > > On 20 Jan., 19:08, Franz Bettag wrote: > > > > Sorry if i am asking a lot of questions lately, but i am trying to get > > > this project of mine working so i can write about the specific > > > problems i ran into and how they got done. > > > > def subnets(xhtml: NodeSeq): NodeSeq = { > > > val content = IPnet.findAll(OrderBy(IPnet.name, > > > Ascending)).map(ip > > > => { > > > > /* Bind the xml */ > > > bind("ip", xhtml, > > > "subnet" -> Text(ip.name.toString), > > > "action" -> SHtml.a(expand(ip.subnet) > > > _, "See all IPs") > > > ) > > > }).mkString > > > > XML.loadString("%s".format(content)) > > > } > > > > def expand(subnet: String): JsCmd = { > > > Log.info("Requested subnet %s".format(subnet)) > > > Alert("subnet %s was requested".format(subnet)) > > > } > > > > The Problem is the "action" that gets binded. I don't get how i have > > > to use SHtml.a to pass a value to the called function. Any hints? > > > > Thank you very much in advance > > > -- > > You received this message because you are subscribed to the Google > > Groups "Lift" group. > > To post to this group, send email to lift...@googlegroups.com. > > To unsubscribe from this group, send email to > > liftweb+unsubscr...@googlegroups.com. > > 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 lift...@googlegroups.com. > > > To unsubscribe from this group, send email to > > > liftweb+unsubscr...@googlegroups.com. > > > 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 lift...@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: Snippet question
Of course i forgot to paste the snippet.. http://pastie.org/787160 On 20 Jan., 21:44, Ross Mellgren wrote: > Scala can't figure out what type of parameter you mean, so you need to > annotate it -- "expand" -> (fooXhtml: NodeSeq) => {... } > > Or use a separately named function with a type signature, e.g. > > def doTheStuff(ns: NodeSeq): NodeSeq) = { Log.error(ns.toStrnig); } > > bind(..., "expand" -> doTheStuff _) > > -Ross > > On Jan 20, 2010, at 3:41 PM, Franz Bettag wrote: > > > "expand" -> (fooXhtml) => { Log.error(fooXhtml.toString); }, > > > error: not a legal formal parameter (pointing at the => ) > > > On 20 Jan., 21:32, greekscala wrote: > >> Hello, > > >> yes a function that takes NodeSeq parameter and returns > >> a NodeSeq :) > > >> "foo" -> (ns) => {function body} or > >> "foo" -> theCalledFunction > > >> best regards > > >> On 20 Jan., 21:26, Franz Bettag wrote: > > >>> How would that look like? > >>> "foo" => nodeSeqMethod _ ? > > >>> On 20 Jan., 21:21, Naftoli Gugenheim wrote: > > Meaning to the right of the -> arrow. > > - > > Franz Bettag wrote: > > Ah figured it out. Played long enough around to get the right way: > > () => {expand(trafficReply.subnet)} > > Another question though, would it be possible to use > and pass the > given NodeSeq over the bind into a function? > > On 20 Jan., 19:08, Franz Bettag wrote: > > > Sorry if i am asking a lot of questions lately, but i am trying to get > > this project of mine working so i can write about the specific > > problems i ran into and how they got done. > > > def subnets(xhtml: NodeSeq): NodeSeq = { > > val content = IPnet.findAll(OrderBy(IPnet.name, > > Ascending)).map(ip > > => { > > > /* Bind the xml */ > > bind("ip", xhtml, > > "subnet" -> Text(ip.name.toString), > > "action" -> SHtml.a(expand(ip.subnet) > > _, "See all IPs") > > ) > > }).mkString > > > XML.loadString("%s".format(content)) > > } > > > def expand(subnet: String): JsCmd = { > > Log.info("Requested subnet %s".format(subnet)) > > Alert("subnet %s was requested".format(subnet)) > > } > > > The Problem is the "action" that gets binded. I don't get how i have > > to use SHtml.a to pass a value to the called function. Any hints? > > > Thank you very much in advance > > -- > You received this message because you are subscribed to the Google > Groups "Lift" group. > To post to this group, send email to lift...@googlegroups.com. > To unsubscribe from this group, send email to > liftweb+unsubscr...@googlegroups.com. > 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 lift...@googlegroups.com. > > To unsubscribe from this group, send email to > > liftweb+unsubscr...@googlegroups.com. > > 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 lift...@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.
Re: [Lift] Re: Snippet question
The problem with writing two spans in Scala is that one is a whole expression. So either concatenate them with ++, or surround them with ..., which is a fake xml element to wrap a few elements as one expression. - Franz Bettag wrote: What i am trying to do, maybe i am doing it all wrong. The html/xml can be found here: http://pastie.org/787126 The question is, what is the best way to render the bound XML which i pass in ip:expand, so that upon the "actions" click, it will be rendered in the correct table on the page. I haven't figured out how a snippet might just return a string which gets passed as id/class of an html-tag. i hope you see my problem, because i am diddling around with this for like 4 hours straight and i don't find a way to simply tell it "the lift way" to do the ajax request and replace div XY. The replacing is not the problem. but how do i get an ID or something into the template where it gets rendered. It is also a mystery to me, why a snippet can't return something like . I haven't found any clue on how to simply return a group of xml objects. i always need to pack around some span or god knows what to make that happen. This is especially bad if you want all the nifty "split design and code" but are not able to somehow let the user design his table because if you nest it (like i try to), you may end up with a tbody in a tbody.. these simple things are really badly documented for beginners. Mostly because i wouldn't know what that method/class i need would be called. :) best regards On 20 Jan., 21:44, Ross Mellgren wrote: > Scala can't figure out what type of parameter you mean, so you need to > annotate it -- "expand" -> (fooXhtml: NodeSeq) => {... } > > Or use a separately named function with a type signature, e.g. > > def doTheStuff(ns: NodeSeq): NodeSeq) = { Log.error(ns.toStrnig); } > > bind(..., "expand" -> doTheStuff _) > > -Ross > > On Jan 20, 2010, at 3:41 PM, Franz Bettag wrote: > > > "expand" -> (fooXhtml) => { Log.error(fooXhtml.toString); }, > > > error: not a legal formal parameter (pointing at the => ) > > > On 20 Jan., 21:32, greekscala wrote: > >> Hello, > > >> yes a function that takes NodeSeq parameter and returns > >> a NodeSeq :) > > >> "foo" -> (ns) => {function body} or > >> "foo" -> theCalledFunction > > >> best regards > > >> On 20 Jan., 21:26, Franz Bettag wrote: > > >>> How would that look like? > >>> "foo" => nodeSeqMethod _ ? > > >>> On 20 Jan., 21:21, Naftoli Gugenheim wrote: > > Meaning to the right of the -> arrow. > > - > > Franz Bettag wrote: > > Ah figured it out. Played long enough around to get the right way: > > () => {expand(trafficReply.subnet)} > > Another question though, would it be possible to use > and pass the > given NodeSeq over the bind into a function? > > On 20 Jan., 19:08, Franz Bettag wrote: > > > Sorry if i am asking a lot of questions lately, but i am trying to get > > this project of mine working so i can write about the specific > > problems i ran into and how they got done. > > > def subnets(xhtml: NodeSeq): NodeSeq = { > > val content = IPnet.findAll(OrderBy(IPnet.name, > > Ascending)).map(ip > > => { > > > /* Bind the xml */ > > bind("ip", xhtml, > > "subnet" -> Text(ip.name.toString), > > "action" -> SHtml.a(expand(ip.subnet) > > _, "See all IPs") > > ) > > }).mkString > > > XML.loadString("%s".format(content)) > > } > > > def expand(subnet: String): JsCmd = { > > Log.info("Requested subnet %s".format(subnet)) > > Alert("subnet %s was requested".format(subnet)) > > } > > > The Problem is the "action" that gets binded. I don't get how i have > > to use SHtml.a to pass a value to the called function. Any hints? > > > Thank you very much in advance > > -- > You received this message because you are subscribed to the Google > Groups "Lift" group. > To post to this group, send email to lift...@googlegroups.com. > To unsubscribe from this group, send email to > liftweb+unsubscr...@googlegroups.com. > 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 lift...@googlegroups.com. > > To unsubscribe from this group, send email to > > liftweb+unsubscr...@googlegroups.com. > > 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 "L
Re: [Lift] Re: Snippet question
Yes, the problem is the operator precedence. If the function consists of one expression you can use parenthesis instead of curly braces. If you're using curly braces, you don't need the parenthesis around the argument: { ns: NodeSeq => ... - Ross Mellgren wrote: Well, it would help to have the compiler error, but I may have gotten precedence wrong. Try: "expand" -> { (fooXhtml: NodeSeq) => ... } instead -Ross On Jan 20, 2010, at 3:51 PM, Franz Bettag wrote: > That doesn't seem to fix the compiler error. :) > > On 20 Jan., 21:44, Ross Mellgren wrote: >> Scala can't figure out what type of parameter you mean, so you need to >> annotate it -- "expand" -> (fooXhtml: NodeSeq) => {... } >> >> Or use a separately named function with a type signature, e.g. >> >> def doTheStuff(ns: NodeSeq): NodeSeq) = { Log.error(ns.toStrnig); } >> >> bind(..., "expand" -> doTheStuff _) >> >> -Ross >> >> On Jan 20, 2010, at 3:41 PM, Franz Bettag wrote: >> >>> "expand" -> (fooXhtml) => { Log.error(fooXhtml.toString); }, >> >>> error: not a legal formal parameter (pointing at the => ) >> >>> On 20 Jan., 21:32, greekscala wrote: Hello, >> yes a function that takes NodeSeq parameter and returns a NodeSeq :) >> "foo" -> (ns) => {function body} or "foo" -> theCalledFunction >> best regards >> On 20 Jan., 21:26, Franz Bettag wrote: >> > How would that look like? > "foo" => nodeSeqMethod _ ? >> > On 20 Jan., 21:21, Naftoli Gugenheim wrote: >> >> Meaning to the right of the -> arrow. >> >> - >> >> Franz Bettag wrote: >> >> Ah figured it out. Played long enough around to get the right way: >> >> () => {expand(trafficReply.subnet)} >> >> Another question though, would it be possible to use >> and pass the >> given NodeSeq over the bind into a function? >> >> On 20 Jan., 19:08, Franz Bettag wrote: >> >>> Sorry if i am asking a lot of questions lately, but i am trying to get >>> this project of mine working so i can write about the specific >>> problems i ran into and how they got done. >> >>> def subnets(xhtml: NodeSeq): NodeSeq = { >>> val content = IPnet.findAll(OrderBy(IPnet.name, >>> Ascending)).map(ip >>> => { >> >>> /* Bind the xml */ >>> bind("ip", xhtml, >>> "subnet" -> Text(ip.name.toString), >>> "action" -> SHtml.a(expand(ip.subnet) >>> _, "See all IPs") >>> ) >>> }).mkString >> >>> XML.loadString("%s".format(content)) >>> } >> >>> def expand(subnet: String): JsCmd = { >>> Log.info("Requested subnet %s".format(subnet)) >>> Alert("subnet %s was requested".format(subnet)) >>> } >> >>> The Problem is the "action" that gets binded. I don't get how i have >>> to use SHtml.a to pass a value to the called function. Any hints? >> >>> Thank you very much in advance >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Lift" group. >> To post to this group, send email to lift...@googlegroups.com. >> To unsubscribe from this group, send email to >> liftweb+unsubscr...@googlegroups.com. >> 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 lift...@googlegroups.com. >>> To unsubscribe from this group, send email to >>> liftweb+unsubscr...@googlegroups.com. >>> 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 lift...@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. > > -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@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. -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@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: Snippet question
What i am trying to do, maybe i am doing it all wrong. The html/xml can be found here: http://pastie.org/787126 The question is, what is the best way to render the bound XML which i pass in ip:expand, so that upon the "actions" click, it will be rendered in the correct table on the page. I haven't figured out how a snippet might just return a string which gets passed as id/class of an html-tag. i hope you see my problem, because i am diddling around with this for like 4 hours straight and i don't find a way to simply tell it "the lift way" to do the ajax request and replace div XY. The replacing is not the problem. but how do i get an ID or something into the template where it gets rendered. It is also a mystery to me, why a snippet can't return something like . I haven't found any clue on how to simply return a group of xml objects. i always need to pack around some span or god knows what to make that happen. This is especially bad if you want all the nifty "split design and code" but are not able to somehow let the user design his table because if you nest it (like i try to), you may end up with a tbody in a tbody.. these simple things are really badly documented for beginners. Mostly because i wouldn't know what that method/class i need would be called. :) best regards On 20 Jan., 21:44, Ross Mellgren wrote: > Scala can't figure out what type of parameter you mean, so you need to > annotate it -- "expand" -> (fooXhtml: NodeSeq) => {... } > > Or use a separately named function with a type signature, e.g. > > def doTheStuff(ns: NodeSeq): NodeSeq) = { Log.error(ns.toStrnig); } > > bind(..., "expand" -> doTheStuff _) > > -Ross > > On Jan 20, 2010, at 3:41 PM, Franz Bettag wrote: > > > "expand" -> (fooXhtml) => { Log.error(fooXhtml.toString); }, > > > error: not a legal formal parameter (pointing at the => ) > > > On 20 Jan., 21:32, greekscala wrote: > >> Hello, > > >> yes a function that takes NodeSeq parameter and returns > >> a NodeSeq :) > > >> "foo" -> (ns) => {function body} or > >> "foo" -> theCalledFunction > > >> best regards > > >> On 20 Jan., 21:26, Franz Bettag wrote: > > >>> How would that look like? > >>> "foo" => nodeSeqMethod _ ? > > >>> On 20 Jan., 21:21, Naftoli Gugenheim wrote: > > Meaning to the right of the -> arrow. > > - > > Franz Bettag wrote: > > Ah figured it out. Played long enough around to get the right way: > > () => {expand(trafficReply.subnet)} > > Another question though, would it be possible to use > and pass the > given NodeSeq over the bind into a function? > > On 20 Jan., 19:08, Franz Bettag wrote: > > > Sorry if i am asking a lot of questions lately, but i am trying to get > > this project of mine working so i can write about the specific > > problems i ran into and how they got done. > > > def subnets(xhtml: NodeSeq): NodeSeq = { > > val content = IPnet.findAll(OrderBy(IPnet.name, > > Ascending)).map(ip > > => { > > > /* Bind the xml */ > > bind("ip", xhtml, > > "subnet" -> Text(ip.name.toString), > > "action" -> SHtml.a(expand(ip.subnet) > > _, "See all IPs") > > ) > > }).mkString > > > XML.loadString("%s".format(content)) > > } > > > def expand(subnet: String): JsCmd = { > > Log.info("Requested subnet %s".format(subnet)) > > Alert("subnet %s was requested".format(subnet)) > > } > > > The Problem is the "action" that gets binded. I don't get how i have > > to use SHtml.a to pass a value to the called function. Any hints? > > > Thank you very much in advance > > -- > You received this message because you are subscribed to the Google > Groups "Lift" group. > To post to this group, send email to lift...@googlegroups.com. > To unsubscribe from this group, send email to > liftweb+unsubscr...@googlegroups.com. > 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 lift...@googlegroups.com. > > To unsubscribe from this group, send email to > > liftweb+unsubscr...@googlegroups.com. > > 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 lift...@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.
Re: [Lift] Re: Snippet question
Well, it would help to have the compiler error, but I may have gotten precedence wrong. Try: "expand" -> { (fooXhtml: NodeSeq) => ... } instead -Ross On Jan 20, 2010, at 3:51 PM, Franz Bettag wrote: > That doesn't seem to fix the compiler error. :) > > On 20 Jan., 21:44, Ross Mellgren wrote: >> Scala can't figure out what type of parameter you mean, so you need to >> annotate it -- "expand" -> (fooXhtml: NodeSeq) => {... } >> >> Or use a separately named function with a type signature, e.g. >> >> def doTheStuff(ns: NodeSeq): NodeSeq) = { Log.error(ns.toStrnig); } >> >> bind(..., "expand" -> doTheStuff _) >> >> -Ross >> >> On Jan 20, 2010, at 3:41 PM, Franz Bettag wrote: >> >>> "expand" -> (fooXhtml) => { Log.error(fooXhtml.toString); }, >> >>> error: not a legal formal parameter (pointing at the => ) >> >>> On 20 Jan., 21:32, greekscala wrote: Hello, >> yes a function that takes NodeSeq parameter and returns a NodeSeq :) >> "foo" -> (ns) => {function body} or "foo" -> theCalledFunction >> best regards >> On 20 Jan., 21:26, Franz Bettag wrote: >> > How would that look like? > "foo" => nodeSeqMethod _ ? >> > On 20 Jan., 21:21, Naftoli Gugenheim wrote: >> >> Meaning to the right of the -> arrow. >> >> - >> >> Franz Bettag wrote: >> >> Ah figured it out. Played long enough around to get the right way: >> >> () => {expand(trafficReply.subnet)} >> >> Another question though, would it be possible to use >> and pass the >> given NodeSeq over the bind into a function? >> >> On 20 Jan., 19:08, Franz Bettag wrote: >> >>> Sorry if i am asking a lot of questions lately, but i am trying to get >>> this project of mine working so i can write about the specific >>> problems i ran into and how they got done. >> >>> def subnets(xhtml: NodeSeq): NodeSeq = { >>> val content = IPnet.findAll(OrderBy(IPnet.name, >>> Ascending)).map(ip >>> => { >> >>> /* Bind the xml */ >>> bind("ip", xhtml, >>> "subnet" -> Text(ip.name.toString), >>> "action" -> SHtml.a(expand(ip.subnet) >>> _, "See all IPs") >>> ) >>> }).mkString >> >>> XML.loadString("%s".format(content)) >>> } >> >>> def expand(subnet: String): JsCmd = { >>> Log.info("Requested subnet %s".format(subnet)) >>> Alert("subnet %s was requested".format(subnet)) >>> } >> >>> The Problem is the "action" that gets binded. I don't get how i have >>> to use SHtml.a to pass a value to the called function. Any hints? >> >>> Thank you very much in advance >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Lift" group. >> To post to this group, send email to lift...@googlegroups.com. >> To unsubscribe from this group, send email to >> liftweb+unsubscr...@googlegroups.com. >> 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 lift...@googlegroups.com. >>> To unsubscribe from this group, send email to >>> liftweb+unsubscr...@googlegroups.com. >>> 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 lift...@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. > > -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@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: Snippet question
That doesn't seem to fix the compiler error. :) On 20 Jan., 21:44, Ross Mellgren wrote: > Scala can't figure out what type of parameter you mean, so you need to > annotate it -- "expand" -> (fooXhtml: NodeSeq) => {... } > > Or use a separately named function with a type signature, e.g. > > def doTheStuff(ns: NodeSeq): NodeSeq) = { Log.error(ns.toStrnig); } > > bind(..., "expand" -> doTheStuff _) > > -Ross > > On Jan 20, 2010, at 3:41 PM, Franz Bettag wrote: > > > "expand" -> (fooXhtml) => { Log.error(fooXhtml.toString); }, > > > error: not a legal formal parameter (pointing at the => ) > > > On 20 Jan., 21:32, greekscala wrote: > >> Hello, > > >> yes a function that takes NodeSeq parameter and returns > >> a NodeSeq :) > > >> "foo" -> (ns) => {function body} or > >> "foo" -> theCalledFunction > > >> best regards > > >> On 20 Jan., 21:26, Franz Bettag wrote: > > >>> How would that look like? > >>> "foo" => nodeSeqMethod _ ? > > >>> On 20 Jan., 21:21, Naftoli Gugenheim wrote: > > Meaning to the right of the -> arrow. > > - > > Franz Bettag wrote: > > Ah figured it out. Played long enough around to get the right way: > > () => {expand(trafficReply.subnet)} > > Another question though, would it be possible to use > and pass the > given NodeSeq over the bind into a function? > > On 20 Jan., 19:08, Franz Bettag wrote: > > > Sorry if i am asking a lot of questions lately, but i am trying to get > > this project of mine working so i can write about the specific > > problems i ran into and how they got done. > > > def subnets(xhtml: NodeSeq): NodeSeq = { > > val content = IPnet.findAll(OrderBy(IPnet.name, > > Ascending)).map(ip > > => { > > > /* Bind the xml */ > > bind("ip", xhtml, > > "subnet" -> Text(ip.name.toString), > > "action" -> SHtml.a(expand(ip.subnet) > > _, "See all IPs") > > ) > > }).mkString > > > XML.loadString("%s".format(content)) > > } > > > def expand(subnet: String): JsCmd = { > > Log.info("Requested subnet %s".format(subnet)) > > Alert("subnet %s was requested".format(subnet)) > > } > > > The Problem is the "action" that gets binded. I don't get how i have > > to use SHtml.a to pass a value to the called function. Any hints? > > > Thank you very much in advance > > -- > You received this message because you are subscribed to the Google > Groups "Lift" group. > To post to this group, send email to lift...@googlegroups.com. > To unsubscribe from this group, send email to > liftweb+unsubscr...@googlegroups.com. > 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 lift...@googlegroups.com. > > To unsubscribe from this group, send email to > > liftweb+unsubscr...@googlegroups.com. > > 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 lift...@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.
Re: [Lift] Re: Snippet question
Scala can't figure out what type of parameter you mean, so you need to annotate it -- "expand" -> (fooXhtml: NodeSeq) => {... } Or use a separately named function with a type signature, e.g. def doTheStuff(ns: NodeSeq): NodeSeq) = { Log.error(ns.toStrnig); } bind(..., "expand" -> doTheStuff _) -Ross On Jan 20, 2010, at 3:41 PM, Franz Bettag wrote: > "expand" -> (fooXhtml) => { Log.error(fooXhtml.toString); }, > > error: not a legal formal parameter (pointing at the => ) > > On 20 Jan., 21:32, greekscala wrote: >> Hello, >> >> yes a function that takes NodeSeq parameter and returns >> a NodeSeq :) >> >> "foo" -> (ns) => {function body} or >> "foo" -> theCalledFunction >> >> best regards >> >> On 20 Jan., 21:26, Franz Bettag wrote: >> >>> How would that look like? >>> "foo" => nodeSeqMethod _ ? >> >>> On 20 Jan., 21:21, Naftoli Gugenheim wrote: >> Meaning to the right of the -> arrow. >> - >> Franz Bettag wrote: >> Ah figured it out. Played long enough around to get the right way: >> () => {expand(trafficReply.subnet)} >> Another question though, would it be possible to use and pass the given NodeSeq over the bind into a function? >> On 20 Jan., 19:08, Franz Bettag wrote: >> > Sorry if i am asking a lot of questions lately, but i am trying to get > this project of mine working so i can write about the specific > problems i ran into and how they got done. >> > def subnets(xhtml: NodeSeq): NodeSeq = { > val content = IPnet.findAll(OrderBy(IPnet.name, > Ascending)).map(ip > => { >> > /* Bind the xml */ > bind("ip", xhtml, > "subnet" -> Text(ip.name.toString), > "action" -> SHtml.a(expand(ip.subnet) _, > "See all IPs") > ) > }).mkString >> > XML.loadString("%s".format(content)) > } >> > def expand(subnet: String): JsCmd = { > Log.info("Requested subnet %s".format(subnet)) > Alert("subnet %s was requested".format(subnet)) > } >> > The Problem is the "action" that gets binded. I don't get how i have > to use SHtml.a to pass a value to the called function. Any hints? >> > Thank you very much in advance >> -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. 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 lift...@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. > > -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@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: Snippet question
"expand" -> (fooXhtml) => { Log.error(fooXhtml.toString); }, error: not a legal formal parameter (pointing at the => ) On 20 Jan., 21:32, greekscala wrote: > Hello, > > yes a function that takes NodeSeq parameter and returns > a NodeSeq :) > > "foo" -> (ns) => {function body} or > "foo" -> theCalledFunction > > best regards > > On 20 Jan., 21:26, Franz Bettag wrote: > > > How would that look like? > > "foo" => nodeSeqMethod _ ? > > > On 20 Jan., 21:21, Naftoli Gugenheim wrote: > > > > Meaning to the right of the -> arrow. > > > > - > > > > Franz Bettag wrote: > > > > Ah figured it out. Played long enough around to get the right way: > > > > () => {expand(trafficReply.subnet)} > > > > Another question though, would it be possible to use > > > and pass the > > > given NodeSeq over the bind into a function? > > > > On 20 Jan., 19:08, Franz Bettag wrote: > > > > > Sorry if i am asking a lot of questions lately, but i am trying to get > > > > this project of mine working so i can write about the specific > > > > problems i ran into and how they got done. > > > > > def subnets(xhtml: NodeSeq): NodeSeq = { > > > > val content = IPnet.findAll(OrderBy(IPnet.name, > > > > Ascending)).map(ip > > > > => { > > > > > /* Bind the xml */ > > > > bind("ip", xhtml, > > > > "subnet" -> Text(ip.name.toString), > > > > "action" -> SHtml.a(expand(ip.subnet) > > > > _, "See all IPs") > > > > ) > > > > }).mkString > > > > > XML.loadString("%s".format(content)) > > > > } > > > > > def expand(subnet: String): JsCmd = { > > > > Log.info("Requested subnet %s".format(subnet)) > > > > Alert("subnet %s was requested".format(subnet)) > > > > } > > > > > The Problem is the "action" that gets binded. I don't get how i have > > > > to use SHtml.a to pass a value to the called function. Any hints? > > > > > Thank you very much in advance > > > > -- > > > You received this message because you are subscribed to the Google Groups > > > "Lift" group. > > > To post to this group, send email to lift...@googlegroups.com. > > > To unsubscribe from this group, send email to > > > liftweb+unsubscr...@googlegroups.com. > > > 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 lift...@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: Snippet question
Hello, yes a function that takes NodeSeq parameter and returns a NodeSeq :) "foo" -> (ns) => {function body} or "foo" -> theCalledFunction best regards On 20 Jan., 21:26, Franz Bettag wrote: > How would that look like? > "foo" => nodeSeqMethod _ ? > > On 20 Jan., 21:21, Naftoli Gugenheim wrote: > > > Meaning to the right of the -> arrow. > > > - > > > Franz Bettag wrote: > > > Ah figured it out. Played long enough around to get the right way: > > > () => {expand(trafficReply.subnet)} > > > Another question though, would it be possible to use > > and pass the > > given NodeSeq over the bind into a function? > > > On 20 Jan., 19:08, Franz Bettag wrote: > > > > Sorry if i am asking a lot of questions lately, but i am trying to get > > > this project of mine working so i can write about the specific > > > problems i ran into and how they got done. > > > > def subnets(xhtml: NodeSeq): NodeSeq = { > > > val content = IPnet.findAll(OrderBy(IPnet.name, > > > Ascending)).map(ip > > > => { > > > > /* Bind the xml */ > > > bind("ip", xhtml, > > > "subnet" -> Text(ip.name.toString), > > > "action" -> SHtml.a(expand(ip.subnet) _, > > > "See all IPs") > > > ) > > > }).mkString > > > > XML.loadString("%s".format(content)) > > > } > > > > def expand(subnet: String): JsCmd = { > > > Log.info("Requested subnet %s".format(subnet)) > > > Alert("subnet %s was requested".format(subnet)) > > > } > > > > The Problem is the "action" that gets binded. I don't get how i have > > > to use SHtml.a to pass a value to the called function. Any hints? > > > > Thank you very much in advance > > > -- > > You received this message because you are subscribed to the Google Groups > > "Lift" group. > > To post to this group, send email to lift...@googlegroups.com. > > To unsubscribe from this group, send email to > > liftweb+unsubscr...@googlegroups.com. > > 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 lift...@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: Snippet question
How would that look like? "foo" => nodeSeqMethod _ ? On 20 Jan., 21:21, Naftoli Gugenheim wrote: > Meaning to the right of the -> arrow. > > - > > Franz Bettag wrote: > > Ah figured it out. Played long enough around to get the right way: > > () => {expand(trafficReply.subnet)} > > Another question though, would it be possible to use > and pass the > given NodeSeq over the bind into a function? > > On 20 Jan., 19:08, Franz Bettag wrote: > > > Sorry if i am asking a lot of questions lately, but i am trying to get > > this project of mine working so i can write about the specific > > problems i ran into and how they got done. > > > def subnets(xhtml: NodeSeq): NodeSeq = { > > val content = IPnet.findAll(OrderBy(IPnet.name, > > Ascending)).map(ip > > => { > > > /* Bind the xml */ > > bind("ip", xhtml, > > "subnet" -> Text(ip.name.toString), > > "action" -> SHtml.a(expand(ip.subnet) _, > > "See all IPs") > > ) > > }).mkString > > > XML.loadString("%s".format(content)) > > } > > > def expand(subnet: String): JsCmd = { > > Log.info("Requested subnet %s".format(subnet)) > > Alert("subnet %s was requested".format(subnet)) > > } > > > The Problem is the "action" that gets binded. I don't get how i have > > to use SHtml.a to pass a value to the called function. Any hints? > > > Thank you very much in advance > > -- > You received this message because you are subscribed to the Google Groups > "Lift" group. > To post to this group, send email to lift...@googlegroups.com. > To unsubscribe from this group, send email to > liftweb+unsubscr...@googlegroups.com. > 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 lift...@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.
Re: [Lift] Re: Snippet question
Meaning to the right of the -> arrow. - Franz Bettag wrote: Ah figured it out. Played long enough around to get the right way: () => {expand(trafficReply.subnet)} Another question though, would it be possible to use and pass the given NodeSeq over the bind into a function? On 20 Jan., 19:08, Franz Bettag wrote: > Sorry if i am asking a lot of questions lately, but i am trying to get > this project of mine working so i can write about the specific > problems i ran into and how they got done. > > def subnets(xhtml: NodeSeq): NodeSeq = { > val content = IPnet.findAll(OrderBy(IPnet.name, > Ascending)).map(ip > => { > > /* Bind the xml */ > bind("ip", xhtml, > "subnet" -> Text(ip.name.toString), > "action" -> SHtml.a(expand(ip.subnet) _, "See > all IPs") > ) > }).mkString > > XML.loadString("%s".format(content)) > } > > def expand(subnet: String): JsCmd = { > Log.info("Requested subnet %s".format(subnet)) > Alert("subnet %s was requested".format(subnet)) > } > > The Problem is the "action" that gets binded. I don't get how i have > to use SHtml.a to pass a value to the called function. Any hints? > > Thank you very much in advance -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@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. -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@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.
Re: [Lift] Re: Snippet question
You can pass a NodeSeq=>NodeSeq function to bind instead of a plain NodeSeq. - Franz Bettag wrote: Ah figured it out. Played long enough around to get the right way: () => {expand(trafficReply.subnet)} Another question though, would it be possible to use and pass the given NodeSeq over the bind into a function? On 20 Jan., 19:08, Franz Bettag wrote: > Sorry if i am asking a lot of questions lately, but i am trying to get > this project of mine working so i can write about the specific > problems i ran into and how they got done. > > def subnets(xhtml: NodeSeq): NodeSeq = { > val content = IPnet.findAll(OrderBy(IPnet.name, > Ascending)).map(ip > => { > > /* Bind the xml */ > bind("ip", xhtml, > "subnet" -> Text(ip.name.toString), > "action" -> SHtml.a(expand(ip.subnet) _, "See > all IPs") > ) > }).mkString > > XML.loadString("%s".format(content)) > } > > def expand(subnet: String): JsCmd = { > Log.info("Requested subnet %s".format(subnet)) > Alert("subnet %s was requested".format(subnet)) > } > > The Problem is the "action" that gets binded. I don't get how i have > to use SHtml.a to pass a value to the called function. Any hints? > > Thank you very much in advance -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@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. -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@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: Snippet question
Ah figured it out. Played long enough around to get the right way: () => {expand(trafficReply.subnet)} Another question though, would it be possible to use and pass the given NodeSeq over the bind into a function? On 20 Jan., 19:08, Franz Bettag wrote: > Sorry if i am asking a lot of questions lately, but i am trying to get > this project of mine working so i can write about the specific > problems i ran into and how they got done. > > def subnets(xhtml: NodeSeq): NodeSeq = { > val content = IPnet.findAll(OrderBy(IPnet.name, > Ascending)).map(ip > => { > > /* Bind the xml */ > bind("ip", xhtml, > "subnet" -> Text(ip.name.toString), > "action" -> SHtml.a(expand(ip.subnet) _, "See > all IPs") > ) > }).mkString > > XML.loadString("%s".format(content)) > } > > def expand(subnet: String): JsCmd = { > Log.info("Requested subnet %s".format(subnet)) > Alert("subnet %s was requested".format(subnet)) > } > > The Problem is the "action" that gets binded. I don't get how i have > to use SHtml.a to pass a value to the called function. Any hints? > > Thank you very much in advance -- You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to lift...@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: Snippet question
If your root package is "com.foo" and you've got a line in Boot: LiftRules.addToPackages("com.foo") then the Misc class has to live in com.foo.snippet to be found by Lift. On Thu, Sep 11, 2008 at 10:37 PM, Charles F. Munat <[EMAIL PROTECTED]> wrote: > > I copied the Misc snippet over from the example, changed the package and > import statements to fit my app, and created a users/index page. > > > Add a User > > > > > > The app builds and runs in Jetty, but when I go to the users/index page > I get: > > Add a User > > > > > Not sure what happened to the Users table. > > The Jetty output says this: > > Snippet Failure: SnippetFailure(/users/ -> ParsePath(List(users, > index),,true,true),Full(Misc.users),Class Not Found) > > Any ideas as to which class it's not finding and why? Is there something > else I need to post? > > Chas. > > > > -- Lift, the simply functional web framework http://liftweb.net Collaborative Task Management http://much4.us Follow me: http://twitter.com/dpp Git some: http://github.com/dpp --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Snippet question
Does the Misc class package corresponds with the snippet folder? ... looks like it could not lod the Misc class as a snippet. Br's, Marius On Sep 12, 8:37 am, "Charles F. Munat" <[EMAIL PROTECTED]> wrote: > I copied the Misc snippet over from the example, changed the package and > import statements to fit my app, and created a users/index page. > > >Add a User > > > > > > The app builds and runs in Jetty, but when I go to the users/index page > I get: > >Add a User > > > > > Not sure what happened to the Users table. > > The Jetty output says this: > > Snippet Failure: SnippetFailure(/users/ -> ParsePath(List(users, > index),,true,true),Full(Misc.users),Class Not Found) > > Any ideas as to which class it's not finding and why? Is there something > else I need to post? > > Chas. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---