And selecting (arbitrarily) the first element is not something I want either.
Martijn
On 4/1/06, Vincent Jenks <
[EMAIL PROTECTED]> wrote:
Why have the default message at all? Why provide something for developers that they should be determining themselves? The default should be the first item in the list...if you need a default, override the method and provide one.On 4/1/06, Johan Compagner < [EMAIL PROTECTED]> wrote:yes moving the method to the renderer and calling that render method in the choice method is fine by me.
Except what is then the default "Choose one" ?
We can add it ofcourse in our default renderer: ChoiceRenderer
But then you have to specify it or subclass choicerenderer. Else suddenly you don't have that default message anymore.
johanOn 3/31/06, Igor Vaynberg <[EMAIL PROTECTED]> wrote:yes its a bit weird. if youd like you are more then welcome to file an rfe and maybe we can clean it up in a future version.
-IgorOn 3/31/06, Vincent Jenks <[EMAIL PROTECTED]> wrote:Got it, thanks. It's confusing that it doesn't work like I described, even though the method can be overridden. It'd be convenient to be able to do it how I posed verses doing this:
//create calendar
List<String> days = DateTime.getDaysListForward(2, 4);
DropDownChoice arrivalChoices = new DropDownChoice("arrivalDate", days)
{
protected String getDefaultChoice(final Object selected)
{
return ""; //get rid of "Choose One" default
}};
arrivalChoices.setChoiceRenderer (new IChoiceRenderer()
{
public String getDisplayValue(Object object)
{
return object.toString();
}
public String getIdValue(Object object, int index)
{
return object.toString();
}});
form.add(arrivalChoices);On 3/30/06, Igor Vaynberg < [EMAIL PROTECTED]> wrote:you are putting getDefaultChoice into the renderer, when it actually belongs in the DropDownChoice
-IgorOn 3/30/06, Vincent Jenks < [EMAIL PROTECTED]> wrote:The code...
//create calendar
List<String> days = DateTime.getDaysListForward(2, 4);
//add quantity select list
form.add(new DropDownChoice("arrivalDate", days, new IChoiceRenderer()
{
protected String getDefaultChoice(final Object selected)
{
return ""; //get rid of "Choose One" default
}
public String getDisplayValue(Object object)
{
return object.toString();
}
public String getIdValue(Object object, int index)
{
return object.toString ();
}
}));
When rendered...I still get the "Choose One" option first. Did I lose too much sleep last night...what did I miss?
--
Wicket 1.2 is coming! Write Ajax applications without touching _javascript_!
-- http://wicketframework.org
