You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Evgeniy Platonov <jo...@ua.fm> on 2007/08/07 14:23:23 UTC

Radio buttons in an AjaxFallbackDefaultDataTable

Hi All,

Maybe the question was already there, but I wasn't able to find it. Please
redirect me if it so.

And the question is: how can I create a column of radio buttons (which all
are in a radio group) using AjaxFallbackDefaultDataTable. Is it posible at
all?

Thanks.

Evgeniy.
-- 
View this message in context: http://www.nabble.com/Radio-buttons-in-an-AjaxFallbackDefaultDataTable-tf4229757.html#a12033167
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: Radio buttons in an AjaxFallbackDefaultDataTable

Posted by Evgeniy Platonov <jo...@ua.fm>.
Hurray, I've found it on my own. Thanks guys, it was quite intuitive :)

So this is what I've got.

Java

        // TablePage.java
    {
        // ... provider obtaining

        List columns = new ArrayList();
        columns.add( new AbstractColumn( new Model( "Select" ) ) {
            public void populateItem( final Item cellItem, final String
componentId, final IModel rowModel ) {
                cellItem.add( new RadioPanel( componentId, rowModel ) );
            }
        } );

        // ... other columns

        RadioGroup radioGroup = new RadioGroup( "typesRadioGroup" );

        Component dataTable = new AjaxFallbackDefaultDataTable(
"typesTable", columns, typeDataProvider, 10 );
        radioGroup.add( dataTable );
        form.add( radioGroup );
        // ... other components
    }

    private class RadioPanel extends Panel {
        public RadioPanel( String id, IModel model ) {
            super( id, model );
            add( new Radio( "select" ) );
        }
    }

HTML

<!-- TablePage.html-->
<wicket:extend>
    
        <table wicket:id="typesTable" class="dataview"
cellspacing="0">[table]</table>
    
</wicket:extend>

<!-- TablePage$RadioPanel.html-->
<wicket:panel>
    <input type="radio" wicket:id="select"/>
</wicket:panel>

Maybe it's not the most elegant solution, but it works. Please tell me if I
missed smth.

Also I suggest to add standard examples with such a case. I guess it would
be useful for other users. If no one objects I may add this to JIRA as
"wish" hmmm...let's say to 1.3.0 RC1.
As I can see you have enough work for beta3.




Evgeniy Platonov wrote:
> 
> Hi All,
> 
> Maybe the question was already there, but I wasn't able to find it. Please
> redirect me if it so.
> 
> And the question is: how can I create a column of radio buttons (which all
> are in a radio group) using AjaxFallbackDefaultDataTable. Is it posible at
> all?
> 
> Thanks.
> 
> Evgeniy.
> 

-- 
View this message in context: http://www.nabble.com/Radio-buttons-in-an-AjaxFallbackDefaultDataTable-tf4229757.html#a12035933
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