Yep, that's the "fallback" solution. But it requires two requests to the server. First getting the javascript and then updating the zone. I would prefer to return everything in one request. That is possible using the internal services.
Thanks, Markus On Mon, Sep 20, 2010 at 11:11 PM, Anna Vo <a...@widen.com> wrote: > Markus- > > You can inject ComponentResources, pass the zoneId and eventlink to > your javascript method with a JSONObject in your javascript > initializer call , and then call the tapestry zone update via client > side javascript. > > Example Java Code: > > @Inject > private ComponentResources resources; > > @Environmental > private JavaScriptSupport javascriptSupport; > > @InjectComponent > private Zone yourZone; > > void afterRender() > { > Link url = resources.createEventLink("yourMethodName"); > JSONObject spec = new JSONObject(); > spec.put("zoneId", yourZone.getClientId()); > spec.put("url", url.toString()); > javascriptSupport.addInitializerCall(InitializationPriority.NORMAL, > "yourJsFunction", spec); > } > > Object onYourMethodName() > { > return yourZone.getBody(); > } > > Example Javascript Code: > > Tapestry.Initializer.yourJsFunction = function(spec) > { > .... > var zone = Tapestry.findZoneManagerForZone(spec.zoneId); > zone.updateFromURL(spec.url); > .... > }; > > > You can also observe the Tapestry.ZONE_UPDATED_EVENT in your > javascript by doing this if you wanted to perform a zone update first > and then do some javascript: > > $(spec.zoneId).observe(Tapestry.ZONE_UPDATED_EVENT, someJsFunction) > > > > On Mon, Sep 20, 2010 at 3:24 PM, Markus Joschko > <markus.josc...@gmail.com> wrote: >> I have a "dialog" on a page which has some eventlinks that are >> triggering serverside actions via ajax requests. >> When some conditions are met, the server will decide to close the >> dialog and update a zone in the page. >> That requires to send the javascript close command and a zone update >> to the browser as response to the event method. >> >> Now I have problems to figure out the best way to do this. >> Although there is the MultiZoneUpdate object I can't use it as the >> RenderCommand that encapsulates the javascript does not work nicely >> with it (leaving the zone name blank gives an error on the >> clientside). >> I found another approach on the mailinglist that works but it >> involves the PageRenderQueue, which is an internal service. >> Is there a better way to achieve what I want? >> >> Regards, >> Markus >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >> For additional commands, e-mail: users-h...@tapestry.apache.org >> >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org