THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
From the event handler method, instead of returning a Block or a Component, return a multi-zone update:
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
@Inject
private Block searchResults;
@Inject
private Block statusBlock;
Object onSuccessFromSearchForm()
{
searchHits = searchService.performSearch(query);
message = String.format("Found %,d matching documents", searchHits.size());
return new MultiZoneUpdate("results", searchResults).add("status", statusBlock);
}
|
The above will work in Tapestry 5.3, but MultiZoneUpdate is deprecated and replaced:
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
@Inject
private Block searchResults;
@Inject
private Block statusBlock;
@Inject
private AjaxResponseRenderer ajaxResponseRenderer;
void onSuccessFromSearchForm()
{
searchHits = searchService.performSearch(query);
message = String.format("Found %,d matching documents", searchHits.size());
ajaxResponseRenderer.addRender("results", searchResults).addRender("status", statusBlock);
}
|
AjaxResponseRenderer adds other useful commands as well. It also has the advantage that a simple return value can be returned to render content for the Zone that triggered the request.
What's that weird number in the middle of the client ids after a Zone is updated?
...