簡體   English   中英

小門-使用Scala在DropDownChoice中獲取所選項目

[英]Wicket - get the selected item in the DropDownChoice using Scala

如何在ListView中通過DropDownChoice獲得所選項目?

我實現了以下代碼:

val listCustomer: java.util.List[Customer] = customerDAO.listCustomers

item.add(new DropDownChoice("customerSelection", listCustomer, new ChoiceRenderer[Customer]("name")))

在這種情況下,我要顯示模型Customer的name屬性。

謝謝

嘗試這個:

new DropDownChoice[Customer](("customerSelection", new Model[Customer], listCustomer, new ChoiceRenderer[Customer]("name"))) {
  protected override def wantOnSelectionChangedNotifications: Boolean = true

  protected override def onSelectionChanged(newSelection: Customer) {
    super.onSelectionChanged(newSelection)
  }
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM