You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@click.apache.org by Josh Kamau <jo...@gmail.com> on 2011/12/29 09:52:31 UTC
Select control
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?
regards.
Josh.
Re: Select control
Posted by Josh Kamau <jo...@gmail.com>.
Thanks Malcom;
Let me check it out right now.
Josh.
On Tue, Jan 3, 2012 at 12:03 PM, Malcolm Edgar <ma...@gmail.com>wrote:
> 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 <jo...@gmail.com> 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 <gi...@gmail.com> wrote:
> >>
> >> Hi, Josh!
> >>
> >> On Thu, Dec 29, 2011 at 5:52 AM, Josh Kamau <jo...@gmail.com>
> 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
> >
> >
>
Re: Select control
Posted by Malcolm Edgar <ma...@gmail.com>.
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 <jo...@gmail.com> 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 <gi...@gmail.com> wrote:
>>
>> Hi, Josh!
>>
>> On Thu, Dec 29, 2011 at 5:52 AM, Josh Kamau <jo...@gmail.com> 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
>
>
Re: Select control
Posted by Josh Kamau <jo...@gmail.com>.
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 <gi...@gmail.com> wrote:
> Hi, Josh!
>
> On Thu, Dec 29, 2011 at 5:52 AM, Josh Kamau <jo...@gmail.com> 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
>
Re: Select control
Posted by Gilberto <gi...@gmail.com>.
Hi, Josh!
On Thu, Dec 29, 2011 at 5:52 AM, Josh Kamau <jo...@gmail.com> 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