There is a patch to RadioGroup in JIRA
(http://issues.apache.org/jira/browse/WICKET-1055) that allows for this
type of scenario to be handled.
It defines some methods to programatically define which Radio's are part
of a RadioGroup.
Alternately you could could try something like:
<table>
<tr wicket:id="selectionRows">
<td><span wicket:id="username">[Username]</span></td>
<span wicket:id="choices" />
</tr>
</table>
final DataView dataView = new DataView("selectionRows", dataProvider) {
protected void populateItem(final Item item) {
UserChoice uc = (UserChoice) item.getModelObject();
IModel selectedChoiceModel = new Model();
item.add(new Label("username", uc.getUsername()));
RadioChoice rc =
new RadioChoice("choices", selectedChoiceModel, ud.getPossibleChoiceList(), new PossibleChoiceRenderer();
rc.setPrefix ("<td>");
rc.setSuffix ("</td>");
item.add(rc));
}
}
Where the choices are placed after the username field. This should work
unless for some reason the <span wicket:id="choices" /> tag renders.
But even in that case I've seen on this list that there are ways to
render the body of a tag only.
Mike
problem with proposed solution is that the number of TR are dynamically created
in DataView (below selectionRows)
<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()));
item.add(new Radio("choice1", new Model())); // what to do here?
item.add(new Radio("choice2", new Model())); // what to do here?
}
}
Date: Thu, 20 Mar 2008 03:20:07 +0000
From: [EMAIL PROTECTED]
To: users@wicket.apache.org
Subject: Re: RadioGroup in TD
Hello,
You can use a RadioChoice for this case, like:
<table>
<tr wicket:id="choice1"></tr>
<tr wicket:id="choice2"></tr>
</table
The setPrefix() and setSuffix() methods can be used to get it to render
the '<td>' and '</td>' markup which will separate each rendered choice.
RadioChoice c1 = new RadioChoice ("choice1", new Model(), OPTIONS1_LIST);
RadioChoice c2 = new RadioChoice ("choice2", new Model(), OPTIONS2_LIST);
c1.setPrefix ("<td>");
c1.setSuffix ("</td>);
c2.setPrefix ("<td>");
c2.setSuffix ("</td>);
add (c1);
add (c2)
Mike
this does not work because each TR has its own RadioGroup (2 TD with radio in
each) so i cannot wrap whole table. how to get this to work?
Date: Wed, 19 Mar 2008 12:31:24 -0700
From: [EMAIL PROTECTED]
To: users@wicket.apache.org
Subject: Re: RadioGroup in TD
you would have one RadioGroup around the table and Radio inside td
-igor
On Wed, Mar 19, 2008 at 11:28 AM, i ii <[EMAIL PROTECTED]> wrote:
will that work with more than one RadioGroup in different TD? i would put
RadioGroup around RadioGroup?
> Date: Wed, 19 Mar 2008 11:22:02 -0700
> From: [EMAIL PROTECTED]
To: users@wicket.apache.org
> Subject: Re: RadioGroup in TD
> put radiogroup around the table
>
> -igor
>
>
> On Wed, Mar 19, 2008 at 11:20 AM, i ii <[EMAIL PROTECTED]> wrote:
> >
> > i tried to add html:
> >
> > < table >h;
> > < td >h; < input wicket:id="rd1" type="radio" / >h; < /td >h;
> > < td >h; < input wicket:id="rd2" type="radio" / >h; < /td >h;
> > < /table >h;
> >
> > > From: [EMAIL PROTECTED]
> > > To: users@wicket.apache.org
> > > Subject: RadioGroup in TD
> > > Date: Wed, 19 Mar 2008 18:16:26 +0000
> >
> >
> > >
> > >
> > > how can i use RadioGroup or RadioChoice when radios are in TD?
> > >
> > >
> > >
> > >
> > >
> > >
> > > i try to use Radio on its own with same name attribute, but cannot. it
says Radio must be inside RadioGroup?
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]