Allows one to have parts of the view that are alternatives to each other.
Allows one to have parts of the view that are alternatives to each other. For example:
bindSwitch("prefix", xhtml, List("concise","detailed")) { if(isInDetailedMode) 1 -> {(xhtml: NodeSeq) => detailedBind(xhtml) } else 0 -> {(xhtml: NodeSeq) => conciseBind(xhtml) } }Note that the final parameter is not a function returning a tuple but an actual tuple. In this example, curly braces denote an expression that evaluates to the tuple which is then passed to bindSwitch. You can then include in the view <prefix:concise> and lt;prefix:detailed> and only one will be displayed and bound, while the other one will not be outputted. Note that this method is also available with the chaining syntax. See nodeSeqToBindable.
The xml prefix of the elements that are alternatives to each other
The xml markup containing the alternate view elements
A Seq[String] of the labels of the elements that are alternatives to each other
A Pair/Tuple2 containing the index in the Seq[String] to use, and a NodeSeq=>NodeSeq to process that element.
Can be used to support a bind-chaining syntax, for use with multiple prefixes.
Can be used to support a bind-chaining syntax, for use with multiple prefixes. For example:
xhtml.bind("prefix1", bindParam1, bindParam2 ).bind("prefix2", bindParam1, bindParam2 )Where bindParam can be the usual arrow -> syntax or any BindParam. Can also be used with the bind overload that takes nodeFailureXform and paramFailureXform arguments, and with bindSwitch. Just import this method, or Util._