I am trying to set an empty value (as a first choice) in a lift select element:
SHtml.select(("", "") :: (MyObject.findA开发者_如何学Goll(By(MyObject.creator, User.currentUser.open_!.id))), ...
However it gives me this error:
error: type mismatch;
found: List[(String, java.lang.Object)]
required: Seq[(String, String)]
Any ideas? Thanks!
Try breaking it up into a few steps.
val choices:Seq[(String,String)] = ("","") :: (all the rest of your options here)
scala> ("","")::List(("c","d"), ("d","e"))
res8: List[(java.lang.String, java.lang.String)] = List((,), (c,d), (d,e))
Then use that choices
var as input to the SHtml.select
method. There's nothing preventing this approach from working.
Example of I82Much has problems with compiling and shows errors. I have modified his answer and have no problems. Tested.
define variable:
val choices = List(("",""), ("S", "Storage"))
and then use it
"strType" -> SHtml.select(choices, Empty, storage.strType(_), "class" -> "smallInputSelect"),
精彩评论