Hi Josh,

there is the method addAll(Collection, String, String) which is pretty
handy for initializing Select controls.

http://click.apache.org/docs/click-api/org/apache/click/control/Select.html#addAll(java.util.Collection,
java.lang.String, java.lang.String)

regards Malcolm Edgar

On Tue, Jan 3, 2012 at 6:10 PM, Josh Kamau <[email protected]> wrote:
> Thanks Gilberto;
>
> I was already doing according to the examples. I was just wondering if there
> is a more automatic way of initializing a select using a list of object
> without having to loop through the list and adding options.
>
> Josh.
>
>
> On Tue, Jan 3, 2012 at 5:55 AM, Gilberto <[email protected]> wrote:
>>
>> Hi, Josh!
>>
>> On Thu, Dec 29, 2011 at 5:52 AM, Josh Kamau <[email protected]> wrote:
>> > Hi guys;
>> >
>> > When i have an object say User, that has an association another object
>> > say,
>> > Role, I want to display the list of roles in a dropdown.
>> >
>> > Do i have to get my roles and then construct option objects ?
>> >
>> > Is there a way the select component construct the options based on the
>> > List
>> > of objects passed through the data provider?
>> >
>>
>> The docs about select[1] has some goods examples. I've done some
>> experiments using JPA[2], maybe it could help as well.
>>
>> Gilberto
>>
>> [1]
>> http://click.apache.org/docs/click-api/org/apache/click/control/Select.html
>> [2]
>> http://code.google.com/p/construtor/source/browse/trunk/park-samples/park-jpa/src/main/java/park/web/page/EditVehicle.java
>
>

Reply via email to