case class Line(guid: String, name: String, price: Double, taxable: Boolean)Next, you can specify snippets to display these items:
private object Info {
val invoices = ValueCell(List(newLine))
val taxRate = ValueCell(0.05d)
val subtotal = invoices.lift(_.foldLeft(0d)(_ + _.price))
val taxable = invoices.lift(_.filter(_.taxable).
foldLeft(0D)(_ + _.price))
val tax = taxRate.lift(taxable) {_ * _}
val total = subtotal.lift(tax) {_ + _}
}
def subtotal(in: NodeSeq) = WiringUI.asText(in, Info.subtotal)
def taxable(in: NodeSeq) = WiringUI.asText(in, Info.taxable)
def tax(in: NodeSeq) = WiringUI.asText(in, Info.tax, JqWiringSupport.fade)
def total(in: NodeSeq) = WiringUI.asText(in, Info.total, JqWiringSupport.fade)
<div>Subtotal: <span class="lift:InvoiceWiring.subtotal">subtotal</span></div>
<div>Tax Rate: <input class="lift:InvoiceWiring.taxRate"></div>
<div>Taxable: <span class="lift:InvoiceWiring.taxable">taxable</span></div>
<div>Tax: <span class="lift:InvoiceWiring.tax">Tax</span></div>
<div>Total: <span class="lift:InvoiceWiring.total">Total</span></div>
--
You received this message because you are subscribed to the Google Groups "Lift" group.
To post to this group, send email to lif...@googlegroups.com.
To unsubscribe from this group, send email to liftweb+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
- Indrajit
Heiko Seeberger wrote:
> David,
>
> Looks very interesting!
> Can't wait to see it in master ...
>
> Heiko
>
> On 2 December 2010 08:56, David Pollak <feeder.of...@gmail.com
> <mailto:feeder.of...@gmail.com>> wrote:
>
> Folks,
>
> I've got Spreadsheets in my veins and I can't seem to get them out
> (I guess that's what happens when you've written 3 commercial
> spreadsheets, one is still available today
> http://www.plsys.co.uk/mesa.htm)
>
> I've added a new feature to Lift (it'll be on review board tomorrow,
> but you can see it in action right now). The feature is called
> wiring. You can wire together a relationship of things. For
> example, a list of invoice lines, subtotals, taxable totals, tax
> rates, etc:
>
> case class Line(guid:String,name:String,price:Double,taxable:Boolean)
> <mailto:lif...@googlegroups.com>.
> To unsubscribe from this group, send email to
> liftweb+u...@googlegroups.com
> <mailto:liftweb%2Bunsu...@googlegroups.com>.
> For more options, visit this group at
> http://groups.google.com/group/liftweb?hl=en.
>
>
>
>
> --
> Heiko Seeberger
>
> Company: weiglewilczek.com <http://weiglewilczek.com>
> Blog: heikoseeberger.name <http://heikoseeberger.name>
> Follow me: twitter.com/hseeberger <http://twitter.com/hseeberger>
> OSGi on Scala: scalamodules.org <http://scalamodules.org>
> Lift, the simply functional web framework: liftweb.net <http://liftweb.net>
> Akka - Simpler Scalability, Fault-Tolerance, Concurrency & Remoting
> through Actors: akkasource.org <http://akkasource.org>
> I've added a new feature to Lift (it'll be on review board tomorrow, but you
> can see it in action right now). The feature is called wiring. You can
> wire together a relationship of things. For example, a list of invoice
> lines, subtotals, taxable totals, tax rates, etc:
Oh yeah!
Reminds me of Flapjax (http://flapjax-lang.org). I'm really looking forward to seeing the details...
Cheers,
D
--
Hey, you took the fun out of my "secret" project!I hope to be putting up a demo soon G-d willing. It's pretty similar to this in its basic purpose, but it's based on a separate FRP framework and it can deal with incremental updates to transformed sequences.So you could doval allPhoneNumbers = for(cs <- contacts) yield cs.flatMap(_.phoneNumbers)val display: Signal[NodeSeq] = for(ps <- allPhoneNumbers) yield ps.flatMap {phone => <tr><td>{phone}</td></tr> }The above is possible with the core FRP project at github.com/reactive. The project that I hadn't publicized primarily adds a bunch of html components whose settings are ajax- or comet-updated signals (and events).I haven't bothered being too detailed because the point of this post is not really to announce it, just to mention that I've been working on something similar but more general.
Sorry -- I'm not clear. Calling addPostPageJavaScript tells Lift to execute javascript when? Immediately?
So what would be a typical use case?