[ 
https://issues.apache.org/jira/browse/WICKET-1055?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12580777#action_12580777
 ] 

Will Hoover commented on WICKET-1055:
-------------------------------------

Another use case for this was brought up on the user forum:

 <table>
    <tr wicket:id="selectionRows">
       <td><span wicket:id="username">[Username]</span></td>
       <td><input wicket:id="choice1" type="radio" /></td>
       <td><input wicket:id="choice2" type="radio"/></td>
    </tr>
 </table>

 final DataView dataView = new DataView("selectionRows", dataProvider) {
    protected void populateItem(final Item item) {
       UserChoice uc = (UserChoice) item.getModelObject();
       item.add(new Label("username", uc.getUsername()));
       // the following radios make up a single group so the total number of 
radio groups = the total number of rows in the table, but a radio group cannot 
be wrapped around two tds
       item.add(new Radio("choice1", new Model()));
       item.add(new Radio("choice2", new Model()));
    }
}

> Add ability to have Radio and RadioGroup not related via component hierarchy
> ----------------------------------------------------------------------------
>
>                 Key: WICKET-1055
>                 URL: https://issues.apache.org/jira/browse/WICKET-1055
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>    Affects Versions: 1.3.0-beta3
>            Reporter: Tim O'Brien
>             Fix For: 1.4-M1
>
>         Attachments: patch-detached-radio.txt
>
>
> I was working on an application that needed to be able to support a Radio 
> button that wasn't nested within a RadioGroup.   Here's an illustration of 
> the component hierarchy I needed to support:
> <span wicket:id="radioGroup1"></span>
> <input type="radio"  wicket:id="option1A"/>
> <input type="radio"  wicket:id="option1B"/>
> The existing RadioGroup/Radio code relies on the component hierarchy, so the 
> only way to render a radio group would be:
> <span wicket:id="radioGroup1">
>   <input type="radio" wicket:id="option1A"/>
>   <input type="radio" wicket:id="option1B"/>
> </span>
> The following patch to Radio and RadioGroup adds the ability to provide an 
> explicit relationship between Radio and RadioGroup - bypassing the component 
> hierarchy.
> Why did I need this?   The application I'm working on creates a form based on 
> meta-data about a specific object.   There were a few situation where I 
> needed to render two radio options in different parts of a form, and then 
> only way to support this was to violate the hierarchy requirement of 
> Radio/RadioGroup.   

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to