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

Greg Guydo commented on WICKET-1727:
------------------------------------

Igor,

I'm not sure this is invalid.  My findings are just the same as Karel.  The use 
case is:

I am a component.  If I am about to be rendered via an AJAX request, I'd like 
some javascript to be executed BEFORE that request.  

However, I will not have my onBeforeRender method called until after all 
prepended javascripts are already added to the response.  This is the earliest 
place the component will itself know its about to be rendered that it can 
prepend javascripts to the AjaxRequestTarget but it is already too late.  



> Prepending JS in AjaxRequestTarget via listener is unusable
> -----------------------------------------------------------
>
>                 Key: WICKET-1727
>                 URL: https://issues.apache.org/jira/browse/WICKET-1727
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.4-M2
>         Environment: java 1.6, windows
>            Reporter: Karel Cabel
>            Assignee: Igor Vaynberg
>             Fix For: 1.5-M2.1
>
>
> If component wants prepend javascript in ajax request, the only way to do it 
> is register itself like listener in ajax request and then implements
> method AjaxRequestTarget.IListener.onBeforeRespond. This method is called 
> before prepending. Other methods (like onRender, onBeforeRender, ...)
> are called AFTER prepending, so they can't be used for...
> It works, but problem is, who will register this component? Now, it must be 
> registered manually in ajax method and this method
> must know, that this component will be rendered in this ajax request. And 
> this is very bad.
> In other words, component has no chance to register itself BEFORE 
> prepending...
> I think, that there should be some method (like onBeforeRender) called in 
> AjaxRequestTarget.respond() BEFORE prepending (called on every component)...
> Karel

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to