Re: Repeat processing

On Fri, Nov 18, 2016 at 1:14 PM, Steven Pemberton <steven.pemberton@cwi.nl>
wrote:

> <instance>
>   <data xmlns="">
>     <a>1</a>
>     <i/>
>     <x>1</x>
>     <x>2</x>
>     <x>3</x>
>   </data>
> </instance>
> <bind ref="i" calculate="../a"/>
> <setvalue ref="a" ev:event="xforms-ready">123456789</setvalue>
> ...
> <repeat ref="x" indexref="i">
>    <output ref="."/>
> </repeat>
>
>
> The problem here is that indexref is readonly.
>
> So when a (and therefore i) is set out of bounds of the repeat, processing
> states that
>  * xforms-scroll-last is sent to the repeat,
>  * the repeat index is set to the size of the repeat collection
>  * therefore indexref is set to the value of the repeat index.
>
> But that last is not allowed, since i is readonly.


There is a problem in general with `indexref` pointing to a readonly node.
For example, the user might tab to repeat iteration 2 in the UI, and the
repeat would attempt to store "2" via `indexref`, would fail, and so the
index would fall back to "1".

The advice might be to just not do that, or the behavior will be unexpected.

-Erik

Received on Tuesday, 22 November 2016 18:06:29 UTC