Vadim Gritsenko <vadim <at> reverycodes.com> writes:

> >><wb:repeater id="myRepeaterId" parent-path="." row-path="TheRowPath">
> >>  <wb:unique-row>
> >>    <wb:value id="myId1" path="myId1"/>
> >>    <wb:value id="myId2" path="myId2"/>
> >>  </wb:unique-row>
> >>  <wb:on-bind>
> >>    <wb:value id="field1" path="field1"/>
> >>    <wb:value id="field2" path="field2"/>
> >>  </wb:on-bind>
> >></wb:repeater>
> 
> I also tend to prefer this approach - same reasoning with ambiguity of 
> unique attribute.

Yes, I only see that wb:unique-row (grouped by type: unique or not unique) is
outside of wb:on-bind (grouped by event: on-bind, on-insert, on-delete) though
it is executed also at on-bind event.

Maybe a third alternative helps for that:

<wb:repeater>
  <wb:on-bind>
    <wb:unique-row>
      <wb:value id="myId1" path="myId1"/>
      <wb:value id="myId2" path="myId2"/>
    </wb:unique-row>
    <wb:value id="field1" path="field1"/>
    <wb:value id="field2" path="field2"/>
  </wb:on-bind>
</wb:repeater>

And a fourth one is to specify values used for uniqueness independent on binding:

<wb:repeater>
  <wb:unique-row>
    <!-- here *no* binding happens! -->
    <wb:element ref="myId1"/>
    <wb:element ref="myId2"/>
  </wb:unique-row>
  <wb:on-bind>
    <wb:value id="myId1" path="myId1"/>
    <wb:value id="myId2" path="myId2"/>
    <wb:value id="field1" path="field1"/>
    <wb:value id="field2" path="field2"/>
  </wb:on-bind>
</wb:repeater>

I used wb:element because I had no name in mind. It also must be clear if you
refer to path (bean or XML) or to id (form model widget). From the XML this is
very similar to Antonio's original proposal and current implementation, but
there is the important difference that there does *not* happen any binding on
wb:unique-row and children. Therefore it's probably clearer than the other
proposals but more verbose.

WDYT?

Joerg

Reply via email to