You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by andrea pantaleoni <an...@fao.org> on 2007/08/24 09:15:18 UTC

Add a choice to a DropDownChoice

Hi,
I'm creating a DropDownChoice in this way: 
DropDownChoice dropDownChoice = new
DropDownChoice(id,PropertyModel(beanName,"propertyName"),List,renderer)

Now I want to add a choice with key 0 and Value "" (empty string)
I was looking for the API and I expected to find something like
dropDownChoice.addChoice(choice) but there is not.

Is there a way to add a extra choice after the dropdown component is built?

Many thanks 
Andrea 
-- 
View this message in context: http://www.nabble.com/Add-a-choice-to-a-DropDownChoice-tf4322067.html#a12307733
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Add a choice to a DropDownChoice

Posted by Nino Saturnino Martinez Vazquez Wael <ni...@jayway.dk>.
Argh sorry for the quick answer.. Instead of using a list to supply 
options for the dropdown you'll need to use a model, and then add the 
option by adding it to the modelobject.. This is how I've done it. 
Afterwards you can either poke model.changed or model.setobject with the 
list.

regards Nino

Nino Saturnino Martinez Vazquez Wael wrote:
> Sure just add it to the model/bean:)
>
> andrea pantaleoni wrote:
>> Hi,
>> I'm creating a DropDownChoice in this way: DropDownChoice 
>> dropDownChoice = new
>> DropDownChoice(id,PropertyModel(beanName,"propertyName"),List,renderer)
>>
>> Now I want to add a choice with key 0 and Value "" (empty string)
>> I was looking for the API and I expected to find something like
>> dropDownChoice.addChoice(choice) but there is not.
>>
>> Is there a way to add a extra choice after the dropdown component is 
>> built?
>>
>> Many thanks Andrea   
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Add a choice to a DropDownChoice

Posted by Nino Saturnino Martinez Vazquez Wael <ni...@jayway.dk>.
Sure just add it to the model/bean:)

andrea pantaleoni wrote:
> Hi,
> I'm creating a DropDownChoice in this way: 
> DropDownChoice dropDownChoice = new
> DropDownChoice(id,PropertyModel(beanName,"propertyName"),List,renderer)
>
> Now I want to add a choice with key 0 and Value "" (empty string)
> I was looking for the API and I expected to find something like
> dropDownChoice.addChoice(choice) but there is not.
>
> Is there a way to add a extra choice after the dropdown component is built?
>
> Many thanks 
> Andrea 
>   

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Add a choice to a DropDownChoice

Posted by Igor Vaynberg <ig...@gmail.com>.
class mypanel extends panel {
private List options;

mypanel () { add(new dropdownchoice("id",model, new PropertyModel(this,
"options"),...);}

now that it is using a property model to retrieve its choices just
add/remove items from the options list

-igor



On 8/24/07, andrea pantaleoni <an...@fao.org> wrote:
>
>
> Hi,
> I'm creating a DropDownChoice in this way:
> DropDownChoice dropDownChoice = new
> DropDownChoice(id,PropertyModel(beanName,"propertyName"),List,renderer)
>
> Now I want to add a choice with key 0 and Value "" (empty string)
> I was looking for the API and I expected to find something like
> dropDownChoice.addChoice(choice) but there is not.
>
> Is there a way to add a extra choice after the dropdown component is
> built?
>
> Many thanks
> Andrea
> --
> View this message in context:
> http://www.nabble.com/Add-a-choice-to-a-DropDownChoice-tf4322067.html#a12307733
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>