Re: Update table column via Zone(s)
Thanks, guys, both approaches works. I went with Renderable, because wanted to render some other markup, not only text. Quick question to Cezary: - why are you updating class fileds withing separate RenderCommand? Any pitfalls? In my experiments rendering and updating class state is working fine withing one class, like this: private RenderCommand cellZoneRenderer(final POS pos, final Contract cnt) { return new RenderCommand() { public void render(MarkupWriter writer, RenderQueue queue) { //update state contract=cnt; pointofsale=pos; //render zone ((RenderCommand) visitsZone.getBody()).render(writer,queue); } }; } On Tue, Feb 22, 2011 at 9:03 PM, Cezary Biernacki cezary...@gmail.comwrote: Hi Dmitriy, I solved similar problem by chaining list of MultiZoneUpdate, each with its own RenderCommand, something like that: @Inject private Block myBlock; MultiZoneUpdate mzu = null; for(String id : indexes) { mzu = addMZU(mzu, zone- + id, prepareRender(id)); } private RenderCommand prepareRendering(final String id) { return new RenderCommand() { @Override public void render(MarkupWriter writer, RenderQueue queue) { ((RenderCommand)myBlock).render(writer, queue); queue.push(new RenderCommand() { @Override public void render(MarkupWriter writer, RenderQueue queue) { currentId = id; } }); } }; } in .tml, I have: t:block t:id=myBlock Here rendering based on ${currentId} /t:block t:loop value=currentId t:zone id=zoneIdt:delegate to=block:myBlock//t:zone /t:loop I can not guarantee that it is the simplest way, but it works for me. Regards, Cezary On Tue, Feb 22, 2011 at 4:16 PM, Dmitriy Vsekhvalnov dvsekhval...@gmail.com wrote: Hi all, i'm looking for some ideas how to update entire column in html table, without updating overall table. For instance: table tr t:type=loop source=rows value=rowValue index=rowIndex td${rowValue.a}/td td${rowValue.b}/td td${rowValue.c}/td td t:zone t:id=myZone id=myZone-${rowIndex} ${some rowValue derived text or other components} /t:zone /td /tr /table on some event i want to update all zones with t:id=myZone. The issue is that with XHR request t:loop is not executed and rowValue property is not bound. So even if i return properly populated MultiZoneUpdate it is rendered incorrectly, because rowValue is not changed before invocations. Any ideas how i can force t:loop to be executed or force myZone body to be rendered (i can re-iterate collection myself in handler method)? Thanks.
Update table column via Zone(s)
Hi all, i'm looking for some ideas how to update entire column in html table, without updating overall table. For instance: table tr t:type=loop source=rows value=rowValue index=rowIndex td${rowValue.a}/td td${rowValue.b}/td td${rowValue.c}/td td t:zone t:id=myZone id=myZone-${rowIndex} ${some rowValue derived text or other components} /t:zone /td /tr /table on some event i want to update all zones with t:id=myZone. The issue is that with XHR request t:loop is not executed and rowValue property is not bound. So even if i return properly populated MultiZoneUpdate it is rendered incorrectly, because rowValue is not changed before invocations. Any ideas how i can force t:loop to be executed or force myZone body to be rendered (i can re-iterate collection myself in handler method)? Thanks.
Re: Update table column via Zone(s)
Hi Dmitriy, I solved similar problem by chaining list of MultiZoneUpdate, each with its own RenderCommand, something like that: @Inject private Block myBlock; MultiZoneUpdate mzu = null; for(String id : indexes) { mzu = addMZU(mzu, zone- + id, prepareRender(id)); } private RenderCommand prepareRendering(final String id) { return new RenderCommand() { @Override public void render(MarkupWriter writer, RenderQueue queue) { ((RenderCommand)myBlock).render(writer, queue); queue.push(new RenderCommand() { @Override public void render(MarkupWriter writer, RenderQueue queue) { currentId = id; } }); } }; } in .tml, I have: t:block t:id=myBlock Here rendering based on ${currentId} /t:block t:loop value=currentId t:zone id=zoneIdt:delegate to=block:myBlock//t:zone /t:loop I can not guarantee that it is the simplest way, but it works for me. Regards, Cezary On Tue, Feb 22, 2011 at 4:16 PM, Dmitriy Vsekhvalnov dvsekhval...@gmail.com wrote: Hi all, i'm looking for some ideas how to update entire column in html table, without updating overall table. For instance: table tr t:type=loop source=rows value=rowValue index=rowIndex td${rowValue.a}/td td${rowValue.b}/td td${rowValue.c}/td td t:zone t:id=myZone id=myZone-${rowIndex} ${some rowValue derived text or other components} /t:zone /td /tr /table on some event i want to update all zones with t:id=myZone. The issue is that with XHR request t:loop is not executed and rowValue property is not bound. So even if i return properly populated MultiZoneUpdate it is rendered incorrectly, because rowValue is not changed before invocations. Any ideas how i can force t:loop to be executed or force myZone body to be rendered (i can re-iterate collection myself in handler method)? Thanks.
Re: Update table column via Zone(s)
Any ideas how i can force t:loop to be executed or force myZone body to be rendered (i can re-iterate collection myself in handler method)? A similar question was asked a couple weeks ago. You can search the list for it for more details (subject was Context of a Zone). If what you are rendering is simple text then you can simply create your MultiZoneUpdate in a loop. Here's what Mark came up with: MultiZoneUpdate update = new MultiZoneUpdate(totalPriceZone, totalPriceZone); for (Item aitem : getItems()) { update = update.add(priceZone- + aItem.getId(), getTotalPriceForItem(aItem)); -- important part } return update; On Tue, Feb 22, 2011 at 7:16 AM, Dmitriy Vsekhvalnov dvsekhval...@gmail.com wrote: Hi all, i'm looking for some ideas how to update entire column in html table, without updating overall table. For instance: table tr t:type=loop source=rows value=rowValue index=rowIndex td${rowValue.a}/td td${rowValue.b}/td td${rowValue.c}/td td t:zone t:id=myZone id=myZone-${rowIndex} ${some rowValue derived text or other components} /t:zone /td /tr /table on some event i want to update all zones with t:id=myZone. The issue is that with XHR request t:loop is not executed and rowValue property is not bound. So even if i return properly populated MultiZoneUpdate it is rendered incorrectly, because rowValue is not changed before invocations. Any ideas how i can force t:loop to be executed or force myZone body to be rendered (i can re-iterate collection myself in handler method)? Thanks. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org