Actually, the built-in select component will handle option groups, but
you need to provide a custom SelectModel.

On Mon, Jul 23, 2012 at 3:13 PM, Carsten Klein
<carsten.kl...@axn-software.de> wrote:
> This should have gone to the mailing list so I will repost it here:
>
>
> Hi Russell,
>
> see http://tapestry.apache.org/using-select-with-a-list.html for a
> thorough explanation on how to do this.
>
> The problem I see in your approach is that you a an arbitrary number of
> select components having the same name. Perhaps you should try and make
> this a single component instead, where the group names are used for
> grouping individual options, namely the users that belong to that group.
>
> E.g.
>
>    Morgue Accessoires Sales Dep
>       John Doe
>       Frank Stein
>    Liquor Sales Dep
>       George Doubleu
>       John Wayne
>
> This is also supported by the HTML select element, using option groups.
>
> And, considering that this will render a single select element instead of
> twenty, this will increase overall useability a lot.
>
> The standard select component does not support this, but you can always
> extend upon that behaviour and implement your own custom component.
>
> Cheers
> -- Carsten
>
>> I am trying to wrap my head around how to do this in tapestry.
>>
>> I have a form with 20 select components that are created with the loop
>> component.
>>
>> Given a Map<Group, User> groupMap...
>>
>> Each select component's value (user) is a value in the map.
>>
>> Each label (group) for each select is the key of the map
>>
>> when a select components value has been changed, I want to update the map
>> with it value.
>>
>> I understand that if this was just one select component I could just say
>> something like OnChangeFromSelectID or a zone.
>>
>> But I'm trying to understand how to do this with 20 select components:
>>
>> TML:
>> <table>
>>
>>   <tr>
>>    <td colspan="2">
>>      <label>Group</label>
>>        </td>
>>          </tr>
>>           <t:loop source="salesGroups" value="group" element="tr">
>>             <td><t:label for="GroupName">${group.groupName}</t:label></td>
>>             <td><t:select t:id="GroupName" model="userModel"
>> value="GroupUser"  /></td>
>>           </t:loop>
>> </table>
>>
>> PAGE CLASS?:
>>     public Object onGroupNameChange(User user)
>>     {
>>       groupMap.put(group, recipient);
>>     }
>>
>>
>> I'm still new but i'm starting to get the hang of T5...
>> Thanks!
>> -Russell
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>



-- 
Jonathan Barker
ITStrategic

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to