2013-05-06 61 views
0

我试图检索文本字段的值填充一个文本框的值,如波纹管显示:检票 - 获得使用斯卡拉

item.add(new TextField("description", new Model[String]() { 
    override def getObject(): String = { 
     customer.description = ??? // I don't know how I can get the value here 
     return ... 
    } 
})) 

我有这个文本字段在ListView插入我需要使用TextField值将其设置在属性模型中。

感谢

回答

1

首先,你需要一个新值发送到服务器,一个可能的解决方案是使用AjaxFormComponentUpdatingBehavior

val description = new TextField("description", new Model[String]) 
description.add(new AjaxFormComponentUpdatingBehavior("keyup") { 
    protected def onUpdate(target: AjaxRequestTarget) { 
    val newValue = description.getDefaultModelObjectAsString 
    } 
}) 

我还建议设置Throttling