Igor Vaynberg a écrit :
do you really think it is necessary to call the listener for each
component
rendered?
why not
IAjaxResponseListener { beforeResponse(map, target); }
the problem i see with callbacks during the render is that
target.prependjavascript will no longer have any effect and can be
confusing.
with beforeresponse listener you can still use the full facilities of the
target
Yes, you're this kind of listener is exactly what I need
so what you would do is traverse the components, build the javascript,
and
use target.appendjavascript() to have it output once all the
components have
been updated.
make sense or did i miss the point?
Yes, exactly
if you _do_ need it to be called _during_ the rendering then we will
have to
extract an interface from the target that only has prependjavascript()
and
you will only get that in the listener instead of the target itself.
you means appendJavascript ?
If we make a listener such as
IAjaxResponseListener {
/**
* Triggered at the very beggining of respond method
*/
beforeResponse(map, target);
// here we can use all target method
//and why not
/**
* Triggered before
* it = appendJavascripts.iterator();
* while
*
* reduicing the scope will be done with an Interface giving only
appendJavascript
*/
afterResponse(map, targetWithReduceScope);
}
I do not need the second method but it could be usefull for others
WDYT?
Thanks
-igor
On 1/23/07, Vincent Demay <[EMAIL PROTECTED]> wrote:
Hi all,
When I re-render a Dojo widget via an ajaxRequestTarget, I have to add
some javascript to the request depending on which widget(component) has
been added to the target. This javascript should be added in order to
re-parse new DojoWidget (from the ajax response) with dojo API. This
kind of parsing should only be done on top level Dojo component because
during parsing sub-dojo-components will be automaticaly parsed.
Actually what I need to do is :
before sending response
1 - looking for all component added to the target
2 - for all top-level Dojo components :
Adding its id to a map
3 - adding a js such as
djConfig.searchIds = ['id1','id2','id3'];dojo.hostenv.makeWidgets().
My problem is I can not do a such stuff in a ajaxBehavior.respond
because this should be done once by request and i do not have any access
to the component list added to the target. On the other hand I can not
extends AjaxRequestTarget because If i do that I can not use AjaxLink or
other Ajax* to re-render a Dojo Component.
So I thought to add a listener on AjaxRequestTarget that should be
called after respondComponent in respondComponents method such as a
IAjaxResponseListener with a onRender(Map/* <String,Component>
*/markupIdToComponent, AjaxRequestTarget target) method.
Have you a better idea and WDYT about listener?
thanks a lot
--
Vincent