I have a component which contributes Js headers. This component is also
rendered by AjaxRequestTarget. The problem is that when rendering ajax
response the Js codes too are getting rendered. These Js codes were already
contributed when this component first rendered (in non-Ajax mode).

To fix this what I initially did was that in the onBeforeRender method of
the component I was checking if the response NOT isAjax then add the header
contributors, else, remove them. This was working fine, but problem is if I
want to implement this is other components I would have to copy n paste the
codes. So I decided to implement a behavior. I added all the header
contributors to that behavior and it was supposed to do the job of adding n
removing the header contributors. But we can't modify hierarchy from
beforeRender of behavior so I am now stuck. Furthermore, this approach is
not capable of removing JS contributed by super calsses of the componenet.

Please suggest.

Thanks and regards,
Apple Grew
my blog @ http://blog.applegrew.com/

Reply via email to