You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Shing Hing Man <ma...@yahoo.com> on 2011/12/10 16:46:21 UTC

Tap 5.3 : AjaxResponseRenderer error when updating two zones with chaining

I am using the mixin zoneRefresh  and AjaxResponseRenderer to update zone  pricesZone and zone currentTimeZone. 

( I have read the excellent blog by Taha on  AjaxResponseRenderer.)

But I get the following error.


 Ajax failure: Status 200 for http://localhost:8080/tapestry5Demo/test/core/mixin/stockwatcher2.priceszone:zonerefresh: undefined
Communication with the server failed: undefined


<t:zone  t:id="pricesZone"  id="pricesZone"  t:update="show" t:mixins="ZoneRefresh" t:period='3'> 
<table  class="watchList" cellpadding="6">
......     <tr class="watchListHeader">
<td class="watchListHeader">Symbol</td> 
<td   >Price</td> 
<td  class="watchListNumericColumn">Change</td>
<td class="watchListRemoveColumn">Remove</td> 
</tr>

<tr t:type="loop" source="stockPrices"  t:id="stockPrices" value="stockPrice">
<td> ${stockPrice.symbol} </td>
<td class="watchListNumericColumn" ><t:output value="stockPrice.price" format="priceFormatter"></t:output> </td>
<td style="${changeStyle}" class="watchListNumericColumn"> 
<t:output value="stockPrice.change" format="changeFormatter"/>
(<t:output value="stockPrice.changePercent" format="changeFormatter"/>%)
</td>
<td class="watchListRemoveColumn">
<t:actionlink  t:id="remove" context="stockPrice.symbol" t:zone="pricesZone" 
class="gwt-Button gwt-Button-remove" > x </t:actionlink>
</td>
</tr> 
</table> 
</t:zone>

<t:zone t:id="currentTimeZone" t:update="show" id="currentTimeZone">
Last update : ${currentTime}
</t:zone>


In java class : 
@InjectComponent
private Zone pricesZone;


protected void onRefreshFromPricesZone() {
refreshWatchList();
if (request.isXHR()) {
// This does not work 
ajaxResponseRenderer.addRender(currentTimeZone).addRender(pricesZone); 
}

}

Is it meant to be an error ? Any explanation on why the above does not work would be appreciated !


However,  the following works. 

protected Object onRefreshFromPricesZone() {
refreshWatchList();
if (request.isXHR()) {
ajaxResponseRenderer.addRender(currentTimeZone);
return pricesZone.getBody();

}

return null;
}


If the table, in zone pricesZone,  is wrapped in a block, then the following also works.

protected void onRefreshFromPricesZone() {
refreshWatchList();
if (request.isXHR()) {
ajaxResponseRenderer.addRender("currentTimeZone", timeBlock).
addRender("pricesZone", pricesBlock);
}

}



 Thanks in advance for any assistance! 

Shing 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org