net.liftweb.util.BindHelpers
BindParam that computes a new attribute value based on the current attribute value. For example, given the following markup:
<lift:AttrBinds > <div test:x="foo" /> <div test:y="foo" /> </lift:AttrBinds >
The following snippet:
import scala.xml._ class AttrBinds { def render(xhtml : NodeSeq) : NodeSeq = BindHelpers.bind("test", xhtml, FuncAttrBindParam("x", { ns : NodeSeq => Text(ns.text.toUpperCase + "X")}, "id"), FuncAttrBindParam("y", { ns : NodeSeq => Text(ns.text.length + "Y")}, ("lift","calcId")))
produces this markup:
<div id="FOOX" /> <div lift:calcId="3Y" />
The name to bind against
A function that takes the current attribute's value and computes the new attribute value
The new attribute label
BindParam that computes a new attribute value based on the current attribute value. For example, given the following markup:
The following snippet:
import scala.xml._ class AttrBinds { def render(xhtml : NodeSeq) : NodeSeq = BindHelpers.bind("test", xhtml, FuncAttrBindParam("x", { ns : NodeSeq => Text(ns.text.toUpperCase + "X")}, "id"), FuncAttrBindParam("y", { ns : NodeSeq => Text(ns.text.length + "Y")}, ("lift","calcId")))produces this markup: