Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/scala/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Scala 如何在提升选择元素中设置空值?_Scala_Lift - Fatal编程技术网

Scala 如何在提升选择元素中设置空值?

Scala 如何在提升选择元素中设置空值?,scala,lift,Scala,Lift,我试图在提升选择元素中设置空值(作为第一选择): SHtml.select(("", "") :: (MyObject.findAll(By(MyObject.creator, User.currentUser.open_!.id))), ... 但是它给了我这个错误: error: type mismatch; found: List[(String, java.lang.Object)] required: Seq[(String, String)] 有什么想法吗? 谢谢 试着把它分成几

我试图在提升选择元素中设置空值(作为第一选择):

SHtml.select(("", "") :: (MyObject.findAll(By(MyObject.creator, User.currentUser.open_!.id))), ...
但是它给了我这个错误:

error: type mismatch;
found: List[(String, java.lang.Object)]
required: Seq[(String, String)]
有什么想法吗?
谢谢

试着把它分成几个步骤

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))

然后使用该
choices
var作为
SHtml的输入。选择
方法。没有任何东西阻止这种方法工作。

i82的示例在编译时有很多问题并显示错误。 我已经修改了他的答案,没有问题。测试

定义变量:

val choices = List(("",""), ("S", "Storage"))
然后使用它

"strType" -> SHtml.select(choices, Empty, storage.strType(_), "class" -> "smallInputSelect"),