Hi All,
I have a requirement for a radio button column in a data table. When a row
is selected data from one of the columns needs to be placed in a text box on
the form. The problem is how to get the selected row to update the text
box. I've searched the forums and googled and haven't found a solution that
I can get to work. The radio buttons themselves work fine until I try to
use an event such as onSelectionChanged which then causes the selection to
be lost which has been discussed in other posts. I've read in another
similar post that using an ajax behavior is a way to deal with the issue but
I haven't been able to figure out how to do that. I'm also struggling to
get my head around the correct way to use models for the radio's. The class
in the model passed in when creating the RadioPanel containing the Radio has
a "selected" property that I've been trying to use for the value of the
radio.
I can get a solution to work using checkboxes but the requirement is
specifically for radio buttons in order to be compatible with the existing
JSP pages in the application. BTW, if I can pull this off there is a good
chance future application features will be implemented in Wicket with the
idea of eventually migrating the entire application to wicket.
If anyone has got something like this working I'd really appreciate some
direction.
Code snippets:
The following code is in addComponents() called from constructor:
final RadioGroup selected = new RadioGroup( "selected" )
// {
// @Override
// protected void onSelectionChanged( Object newSelection )
// {
// super.onSelectionChanged( newSelection );
// newSelection is always
null
// }
// @Override
// protected boolean wantOnSelectionChangedNotifications()
// {
// return true;
// }
// }
;
columns.add( new AbstractColumn( new Model( "" ))
{
public void populateItem( final Item cellItem, final
String componentId,
final IModel rowModel )
{
cellItem.add( new RadioPanel( componentId,
rowModel ));
}
});
AjaxFallbackDefaultDataTable table = new
AjaxFallbackDefaultDataTable(
"table", columns, provider, 15 );
selected.add( table );
this.add( selected );
The panel with the Radio:
private class RadioPanel extends Panel
{
public RadioPanel( String id, IModel model )
{
super( id, model );
add( new Radio( "select", new PropertyModel( model,
"selected" )));
}
}
The html for the panel:
<wicket:panel>
<input wicket:id="select" type="radio"/>
</wicket:panel>
The html for the radio group and table:
<div wicket:id="selected">
<table wicket:id="table"></table>
</div>
Thanks in advance,
Jim
--
View this message in context:
http://www.nabble.com/help-with-RadioGroup-in-Table-tp18036005p18036005.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]