hi,

I am new to wicket so I am not sure how simple this issue is.

I am creating DropDownChoice components. I want to a)  build the the 
Options from a list of Objects (not primitives) and b) want to render 
the option id and value as an attribute of the object in the list. this 
definitly works in the following sample code:

public class WicketSandbox extends WebPage
{
    public WicketSandbox()
    {
        addPageTitle("Development Sandbox");
        final Form myForm = new Form("form");
        add(myForm);

        final ChoiceRenderer myRenderer = new ChoiceRenderer("name", "id");
        myForm.add(new DropDownChoice("select",new MyChoices(),myRenderer));

    }
}

But as soon as I add an IModel to the form it seems that the 
DropDownChoice looks up the choices in the form's IModel.  I have tried 
to use the other constructors for the DropDownChoice which require an 
(String id, IModel model, IModel choices, IChoicerenderer renderer) but 
I can't figure out what is the difference between the 2 IModel objects 
that have to be provided. If I provide twice a ref to the same object I 
get a different error:

The expression 'id' is neither an index nor is it a method for the list class 
java.util.ArrayList

this is an improvement because it is accessing the right object and 
retrieving the list of choices but not extracting the the objects from 
the list as it does when I use (String id, IModel choices, 
IChoicerenderer renderer).

In all cases if I remove the ChoiceRenderer my web page builds and 
displays but I see object.toString() values in my drop-downs.

Any tips or pointers would be greatly appreciated.

Florian Hehlen

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to