Hi all,

Let me explain my requirement properly.

I have created a table using wickets component DefaultTableModel. Number of
rows in the table is dynamic. One of the column is radio button. This radio
button is used to select that particular row.

I used wickets fragment feature to implement this.  My html has something
like this...

 <div>
        <table  cellpadding="0" cellspacing="1" wicket:id="table"/>
    </div>

<wicket:fragment wicket:id="radioButtonFrag">
 
        <input type="radio" wicket:id="selected"/>
        
</wicket:fragment>

My Fragment is like this...

        public class FlightSelectionFragment extends Fragment {
                
                public FlightSelectionFragment(String id, String markupId,
                                MarkupContainer markupProvider, RadioGroup 
radioGroup) {
                        super(id, markupId, markupProvider);
                        radioGroup.add(new Radio("selected", new Model("")));
                        add(radioGroup);
                }
}

The exception that i get is 

WicketMessage: Error attaching this container for rendering:
[MarkupContainer [Component id = table, page =
com.emirates.poc.web.flight.page.SearchPage, path =
0:table.DefaultDataTable, isVisible = true, isVersioned = true]]Root
cause:java.lang.IllegalArgumentException: A child with id 'selected' already
exists:.

It means i can only add one Radio button to the RadioGroup. As the Radio
component get's created at runtime, i cannot specify it's name in the java
and html.  There must be a way to add multiple radio button to the
RadioGroup using fragment.  The same thing works if i replace Radio with
checkbox component.

How to solve this issue?



Sathish Gopal wrote:
> 
> Hi,
> 
> I was actually looking for integrating RadioButton with DefaultDataTable
> component available in Wicket.
> 
> My requirement is,  i need to show a row of data's with one column being a
> RadioButton. I use DataTable component for showing list of Data's. The
> number of columns is known only at runtime.  This radioButton is used to
> select that particular row of Data. How do i specify the name of the
> component in my html. i.e 
> 
> <wicket:fragment wicket:id="radioButtonFrag">
>  
>       <input type="radio" wicket:id="selected"/>
>       
> </wicket:fragment>
> 
> The name of the above radio button is selected. This same named (id
> =selected) radio button cannot be added again to the RadioGroup has i loop
> thro... Is there a way to dynamicaly name component at runtime. I think
> this is just a problem of naming the Radiobutton as the records are know
> only at runtime. 
> 
> 
> Hoover, William wrote:
>> 
>> see http://cwiki.apache.org/WICKET/using-radiogroups.html
>> 
>> -----Original Message-----
>> From: Sathish Gopal [mailto:[EMAIL PROTECTED]
>> Sent: Sunday, April 06, 2008 6:07 AM
>> To: users@wicket.apache.org
>> Subject: RadioButton inside DataTable
>> 
>> 
>> 
>> Hi all,
>> 
>> I'm trying to build DataTable using the Wickets DefaultDataTable
>> component.
>> One of the column in the list is a RadioButton component, which is used
>> to
>> select a particular row.
>> 
>> I'm using wicket fragment feature. 
>> 
>> My html looks like this...
>> 
>>  <div>
>>         <table  cellpadding="0" cellspacing="1" wicket:id="table"/>
>>     </div>
>> 
>> <wicket:fragment wicket:id="radioChoiceFrag">
>>  
>>      <input type="radio" wicket:id="selected"/>
>>      
>> </wicket:fragment>
>> 
>> My fragment looks like this..
>> 
>>      public class FlightSelectionFragment extends Fragment {
>>              private RadioGroup radioGroup;
>> 
>>              public FlightSelectionFragment(String id, String markupId,
>>                              MarkupContainer markupProvider) {
>>                      super(id, markupId, markupProvider);
>>                      radioGroup.add(new Radio("selected", new Model("")) {
>>                                   });
>>              }
>> 
>> How do i add the same Radio button component (id=selected) to RadioGroup
>> (id=radioChoicegroup) for multiple rows. i.e Assuming there are three
>> rows
>> in table. So i need 3 radio buttons which will be added to the same radio
>> group (id=radioChoicegroup). But the component id (id=selected) cannot be
>> the same for all the three rows. This gives Runtime Exception. How to
>> handle
>> this issue?
>> 
>> 
>> 
>> 
>> 
>> -- 
>> View this message in context:
>> http://www.nabble.com/RadioButton-inside-DataTable-tp16522717p16522717.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]
>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>> 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/RadioButton-inside-DataTable-tp16522717p16537404.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]

Reply via email to