Hi all,

I've used quite intensively the DropDownChoice component on my forms.

But in some cases, I've added to some of those DropDownChoices some
ChoiceRenderer.

The choices Model I could pass to CTOR could easily be sorted, but in this
case, not the rendered values behind this list .

As an example this code :

DropDownChoice<Locale> locs = new DropDownChoice<Locale>("locs"
                , new PropertyModel<Locale>(this, "session.locale")
                , Arrays.asList(Locale.getAvailableLocales())
                , new IChoiceRenderer<Locale>() {
                    public Object getDisplayValue(Locale object) {
                        return object.getDisplayName();
                    }

                    public String getIdValue(Locale object, int index) {
                        return Integer.toString(index);
                    }
                }
        );


This code would build a select element but the rendered values (based on
your current Locale) would not be sorted.
If I sort the  Locale.getAvailableLocales()  list, this will result in an
indexed based sorted  list, not on a ChoiceRendered base.


How could I sort this kind of dropdownChoices ? What would be the best
solution ?



Thanks a lot for your answer.


-R-








--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/DropDownChoice-sorted-choice-rendered-Values-tp3466087p3466087.html
Sent from the Users forum mailing list archive at Nabble.com.

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

Reply via email to