You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Martin Grigorov (JIRA)" <ji...@apache.org> on 2012/08/17 07:02:37 UTC

[jira] [Commented] (WICKET-4716) Order of behavior addition to Component not reflected in generated page

    [ https://issues.apache.org/jira/browse/WICKET-4716?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13436558#comment-13436558 ] 

Martin Grigorov commented on WICKET-4716:
-----------------------------------------

Please create a quickstart and attach it.
Also please use Wicket Ajax behaviors for the demo, like AjaxEventBehavior.
Thanks!
                
> Order of behavior addition to Component not reflected in generated page
> -----------------------------------------------------------------------
>
>                 Key: WICKET-4716
>                 URL: https://issues.apache.org/jira/browse/WICKET-4716
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.5.7
>            Reporter: Nick Pratt
>
> I have a Wicket Panel.  I add two WiQuery event behaviors (simple onclick handlers) to it that inject JS: 
> add( new BehaviorA(), new BehaviorB() );
> or
> add( new BehaviorA() );
> add( new BehaviorB() );
> The generated page has the JS for the two behaviors in reverse order - Javascript for B is called before A.
> I expected that the behaviors would be added to the page in the order in which I added them in code.
> Example of BehaviorA:
> public class HideOnClickBehavior extends WiQueryAbstractBehavior
> {
> 	public HideOnClickBehavior()
> 	{
> 	}
> 	@Override
> 	public JsStatement statement()
> 	{
> 		final Component component = getComponent();
> 		Event event = new Event( MouseEvent.CLICK )
> 		{
> 			@Override
> 			public JsScope callback()
> 			{
> 				JsStatement hideStatement = new JsQuery( component ).$().chain( new Hide() );
> 				return JsScope.quickScope( hideStatement.render() );
> 			}
> 		};
> 		return new JsQuery( component ).$().chain( event );
> 	}
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira