> If a core mixin was provided that may fill this gap, and ditto for radio > or checkboxes. But - and this is just my 2 pence - mixins is another > subject that a newbie/new adopter has to learn, whereas they are already > familiar with context and zone parameters from fundamental components > like an actionlink.
They wouldn't see the difference - they'd be using the component that would internally use the mixin. They won't need to specify the mixin themselves. Take a look at http://tapestry.apache.org/component-mixins.html in the section "Implementation Mixins" for how this can work and why it's not *yet* possible to build this! >> >> Josh >> >> On Thu, Feb 24, 2011 at 8:49 AM, Richard Hill <r...@su3analytics.com> wrote: >> > >> > Yes agreed - I think t:select should take an optional context parameter. >> > I will file a JIRA. >> > >> > As a work around I see two options: >> > >> > 1) In my case here I don't need to actually re-render a zone when the >> > user changes the selection. So I will probably just render the select >> > "manually" and attach my own js handler to fire back the change to the >> > server. >> > >> > 2) If you did require a zone update, I think you would have to use >> > context-dependent select and option models which provided client-side >> > option values that were some combination of the context and option id. >> > These could then be parsed out server-side when a user makes his >> > selection. But sounds a bit hacky :) >> > >> > Thiago - thanks for your help and patience on this. >> > >> > Cheers Richard >> > >> > >> > >> > >> > >> > On Thu, 2011-02-24 at 13:24 -0300, Thiago H. de Paula Figueiredo wrote: >> >> On Thu, 24 Feb 2011 13:15:51 -0300, Richard Hill <r...@su3analytics.com> >> >> wrote: >> >> >> >> > Thanks for this. I think I understand better what ValueEncoder does now. >> >> > However, this doesn't answer my question: when I say "context" I mean >> >> > the loop context - not the option value that was selected. This I know >> >> > how to get, but I don't know for which loop item it refers. >> >> >> >> The Loop component doesn't have a context, so now I know what you were >> >> talking about. >> >> >> >> > Let's say I have a list of pens, and each can be red, blue or green: >> >> > >> >> > <t:loop source="pens" value="pen"> >> >> > ${pen.id} >> >> > >> >> > <t:select t:id="penSelect" t:model="penModel" t:value="penOption" /> >> >> > >> >> > </t:loop> >> >> > >> >> > The penModel just models the three possible colors, penOption is the >> >> > selected color. >> >> > >> >> > Now when a user makes a change, the onValueChangedFromPenSelect(Color >> >> > color) method is called. >> >> > >> >> > No problem - but for which pen is it called? Without a loop context I do >> >> > not know this. >> >> >> >> The example makes it all very clear. It seems to me that Select needs an >> >> improvement: having a context parameter that allows you to pass more >> >> values to the event handler method. For example, your method would be >> >> onValueChangedFromPenSelect(Color color, XXX xxx). Please file a JIRA >> >> about it. >> >> >> >> > Given what you've said about value encoder, can I use this to store some >> >> > combination of both the pen id and the color id as the option value? >> >> >> >> I think that's technically possible, but I'd not recommend that. >> >> >> > >> > >> > >> > --------------------------------------------------------------------- >> > 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 > > -- Andreas Andreou - andy...@apache.org - http://blog.andyhot.gr Apache Tapestry PMC / http://chesstu.be owner Open Source / JEE Consulting --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org