Thank you. That makes sense now. On Mon, Jan 10, 2011 at 11:44 PM, Josh Canfield <[email protected]> wrote: > MultiZoneUpdate is confusing for sure. > > public MultiZoneUpdate add(String zoneId, Object renderer) > { > return new MultiZoneUpdate(zoneId, renderer, this); > } > > See how it returns a new instance of the update when you call add? > > You can change your code like this and it should get things working: > > MultiZoneUpdate update = MultiZoneUpdate("totalPriceZone",totalPriceZone) > for(Item item : getItems) { > update = update.add("itemZone-" +item.getId(), itemZone); > } > return update; > > There are some recent defects filed to get this interface fixed, > hopefully someone will get some time to look at it for the 5.3 > release. > > Josh > > On Mon, Jan 10, 2011 at 9:32 PM, Mark <[email protected]> wrote: >> I have a zone that is rendered in a loop. It has a text field that >> can be changed and it updates the cost for that row and the total cost >> at the bottom of the page. This all works fine regardless of how many >> items are in the row. A user change to the qty in a row will update >> that row's total and the total at the bottom of the page. >> >> My code looked something like: >> return new MultiZoneUpdate("totalPriceZone",totalPriceZone).add("itemZone-" >> +item.getId(), itemZone); >> >> That works fine. >> >> Now the requirements changed and I need to update the total on rows >> other than the row that was changed. My first through was something >> like this: >> MultiZoneUpdate update = MultiZoneUpdate("totalPriceZone",totalPriceZone) >> for(Item item : getItems) { >> update.add("itemZone-" +item.getId(), itemZone); >> } >> return update; >> >> But that doesn't work. It only updates the totalPriceZone. So I >> tried going back to what I had before, but this time creating the >> Update on one line and then adding the itemZone on the next like this: >> >> MultiZoneUpdate update = MultiZoneUpdate("totalPriceZone",totalPriceZone) >> update.add("itemZone-" +item.getId(), itemZone); >> return update; >> >> I expected the code above to have the same result as my original code, >> but it doesn't. It only updates the totalPriceZone. >> >> Should I expect the first piece of code and the last to do the same >> thing or is there some reason that you can't call add on the >> MultiZoneUpdate after it is constructed? >> >> Any other suggestions on how to create a multizone update when the >> number of zones to add vary at runtime? >> >> Mark >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >
--------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
