We encountered problems with the new fix because it traverses 2 levels deep
instead of 1.
The effect was that in our project, the Radios didn't work either.

So we did the traversal in the Java code:

public abstract class CustomAjaxFormChoiceComponentUpdatingBehaviour extends
AjaxFormChoiceComponentUpdatingBehavior
{

        /* (non-Javadoc)
         * @see
org.apache.wicket.ajax.form.AjaxFormChoiceComponentUpdatingBehavior#onUpdate(org.apache.wicket.ajax.AjaxRequestTarget)
         */
        @Override
        protected abstract void onUpdate(AjaxRequestTarget target);
        
        @Override
        public void renderHead(IHeaderResponse response)
        {
                
                //
                // step through all children of this e.g. RadioGroup and
                // attach an 'onclick' handler to all children which are of 
type Radio
                final StringBuilder a=new StringBuilder(400);
                
                ((MarkupContainer)getComponent()).visitChildren(new
org.apache.wicket.Component.IVisitor()
                {
                        public Object component(org.apache.wicket.Component 
component)
                        {
                                if(component instanceof RadioGroup
                                                || component instanceof 
RadioChoice)
                                        return 
CONTINUE_TRAVERSAL_BUT_DONT_GO_DEEPER;
                                
                                if(component instanceof Radio)
                                {
                                        // muss hier passieren, im onbind hat 
er noch keine kinder:
                                        component.setOutputMarkupId(true);      
                                        
                                        // eventhandler:
                                        a.append("Wicket.Event.add(wicketGet('")
                                        .append(component.getMarkupId())
                                        .append("'),'click', function() {")
                                        .append(getEventHandler())
                                        .append("});\n");                       
                                                
                                }
                                
                                return CONTINUE_TRAVERSAL;
                        }
                });
                
                response.renderOnLoadJavascript(a.toString());
        }

}


Greetings, Tony

-- 
View this message in context: 
http://www.nabble.com/Ajax-enabled-radiogroup-tp14797035p16305395.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