0

DropDownChoice アイテムを選択した直後に、モデルまたはオブジェクトを更新する必要があります。

ベローは私が取り組んでいるコードです:

add(new ListView[Company]("listCompanies", listData) {

    override protected def onBeforeRender() {
      //
      // ...
      super.onBeforeRender()
    }

    def populateItem(item: ListItem[Company]) = {
      var company = item.getModelObject()

      //...

      val listClients: java.util.List[Client] = clientControler.listClients


      item.add(new DropDownChoice("clientSelection", listClients,new ChoiceRenderer[Client]("name")))

Company オブジェクトのプロパティを含むリストビューで、DropDownChoice の name プロパティを選択すると、モデルの Company が選択された Client Name で更新されます。

どうすればこれを達成できますか?

ありがとう

4

3 に答える 3

7

更新動作を追加する必要があります:

    add(new DropDownChoice<Client>("clientSelection", listClients)
                .add(new AjaxFormComponentUpdatingBehavior("onchange") {

                    private static final long serialVersionUID = 1L;

                    @Override
                    protected void onUpdate(AjaxRequestTarget target) {

// update your model here
// then you need to add model to target
                        target.add();
                    }
                }));
于 2013-04-09T06:35:52.370 に答える