You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by c c <cl...@gmail.com> on 2009/04/24 02:37:17 UTC

RadioGroup and nested ListView

Hi all, I am new at this so please be gentle.

I would like to use a RadioGroup to select one "element" among a list
of elements organized in groups.
I have two nested ListView, the outer looping over the groups, the
inner one looping over the elements of each group.
Each element of the inner listview has a Radio.

I have tried the following but I get the error:
WicketMessage: Component radio must be applied to a tag with 'type'
attribute matching 'radio', not 'null'
probably because the radio are in the items of the inner ListView
while the outer ListView is added to the RadioGroup.


Form form = new Form("form");
add(form);		
final RadioGroup radioGroup = new RadioGroup("radioGroup", new Model());

ListView listviewGroups = new ListView("listviewGroups", groups){

	@Override
	protected void populateItem(ListItem groupItem) {
		SubCategory group = (SubCategory) groupItem.getModelObject();
		groupItem.add(new Label("group", group.getName()));

		ListView listviewElements = new ListView("listviewElements",
                                 service.getElementsForGroup(group.getId())) {

			@Override
			protected void populateItem(ListItem elementItem) {
				Element element = (Element) futureItem.getModelObject();
				elementItem.add(
					new Label("element", element.getName()));
				elementItem.add(
					new Radio("radio", elementItem.getModel());			
			}	        	
		};
		groupItem.add(listviewElements);		
	}
};
radioGroup.add(listviewGroups);
form.add(radioGroup);

/*----- and this in the html -----------*/

<form wicket:id="form">
	<div wicket:id="radioGroup">
		<div wicket:id="listviewGroups" >
			<span wicket:id="group"></span>
			<table>
				<tr wicket:id="listviewElements">
					<td>
				    		<input wicket:id="radio"/>
					  	<span wicket:id="element"></span>
					</td>
				</tr>
			</table>
		</div>
	</div>
</form>

Many thanks in advance for any help!

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: RadioGroup and nested ListView

Posted by Clode <cl...@gmail.com>.
yes! many tanks!
.... staring at the forest I missed the tree ;)


Newgro wrote:
> 
> The message says that you have to put in the type attribute to this line
> 
> <input wicket:id="radio"/>
> should be
> <input type="radio" wicket:id="radio"/>
> 
> Hth
> Per
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/RadioGroup-and-nested-ListView-tp23207864p23215966.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: RadioGroup and nested ListView

Posted by Per Newgro <pe...@gmx.ch>.
The message says that you have to put in the type attribute to this line

<input wicket:id="radio"/>
should be
<input type="radio" wicket:id="radio"/>

Hth
Per

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org