http://wicketstuff.org/wicket/ajax/choice

-igor

On Wed, Aug 19, 2009 at 7:54 AM, Linda van der
Pal<[email protected]> wrote:
> I have a page with a dropdown list on it with authors. If I enter a new book
> I want my fields to be filled based on the ISBN. This works just fine. But
> now I want those fields to be filled with data  I collect from the internet,
> meaning that it isn't always already in my database, and therefor the author
> might not yet be in the list. I have already decided to save the new author
> so I can select it in the list, but the list isn't updated, and I can't
> figure out how to get it to update.
>
> Here are some pieces of code I think are relevant:
>
> This is how I create the authorfield:
>
> authorField = new MultiSelectFieldSwitchPanel("authors",
> dataRetriever.fetchAuthors(), new PropertyModel(this, "book.authors"));
>
>
> dataRetriever.fetchAuthors return a List<Author>
>
> Here's the constructor of MultiSelectFieldSwitchPanel which extends
> FormComponentPanel:
>
> public MultiSelectFieldSwitchPanel(final String id, final List<? extends
> DomainObject> authors, final IModel<List<Author>> model) {
>   super(id, model);
>   lmc = new ListMultipleChoice("selectField", new
> PropertyModel<List<Author>>(this, "selectedObjects"),
>          authors, new ChoiceRenderer<DomainObject>("name", "id"));
>   init(lmc);
> }
>
> The init method adds a link to swap the lmc for a textfield where new
> authors can be entered, which is not really relevant in this case.
>
> I have of course already added authorField to the AjaxRequestTarget in the
> behavior that is triggered by updating the ISBN.
>
> Regards,
> Linda
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to