I am a wicket newbie, but when I had a similar thing I wanted to do, I 
just used CSS to make the component invisible/visible (display: none). 
The ajax behavior just changed the style. I am pretty certain setVisible 
is not the best/easiest way to handle this.

James

kenixwong wrote:
> I'd like to be able to click a set of radio box and then make a component
> visible or invisible using Ajax or else. Is that any idea for it? 
>
> As i read the radioGroup and radioChoice, can i know what is the different
> btw both? 
>
> Here is my partial code:
> categoryField = new TextField("category");
> categoryField.setOutputMarkupId(true);
>
> final RadioGroup radioGroup = new RadioGroup("RadioGroup", new Model());
> listView = new ListView("ListView", optionClassList)
> {
>       protected void populateItem (final ListItem item)
>       {
>               Radio radio = new Radio("radio", item.getModel());
>               radio.add (new AjaxEventBehavior("onclick")
>                {
>                        protected void onEvent (AjaxRequestTarget target)
>                       {
>                           if(item.getModelObject ().equals("abc")){
>                               target.addComponent 
> (departmentChoice.setVisible(false));
>                            }else{
>                                       target.addComponent 
> (categoryField.setVisible(false));
>                             }
>                       }
>                  });
>               item.add(radio);
>               item.add(new Label("label", (String)item.getModelObject ()));
>       }
> };
> radioGroup.add (listView);
> add(radioGroup);
>               
>
> It work, but oaly the first time. Mean after i clicked on the radio few
> times, it nothing happen. 
>
> thanks for help... 
>   


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to