Re: How to change the order of repeat-items?

Having actions for sorting in the UI and reordering in the model would 
really fit my needs. At the moment i'm resorting to scripting against 
the DOM from the HTML host language, which gives me quite a brittle 
implementation strongly tied to the plugin:

(Novell plugin specific code)
..
var repeat = document.getElementById(repeatid);
var index = repeat.getIndexObject().getIndex();
..
(DOM manipulation goes here)
..
repeat.getIndexObject().setIndexByIndex(newindex, true);
..

I tried implementing this in firefox, as the IDL hinted that it's 
counterparts would be repeat.index and repeat.setIndex(), with no luck. 
An action like <xf:move-up at="index('repeatid')"/> or <xf:swap 
at="index('repeatid')" for="index('repeatid')+1"/> would circumvent a 
lot of cross-browser/cross-plugin scripting woes.

Regards,
Suzan Foster.
-- 
John Boyer wrote:

>Hey, that's a really neat thought!
>
>I'd previously felt that we would do data sorting by an action
>rather than an extension function because none of our other 
>functions have these kinds of side effects (XPath engines
>aren't even guaranteed to have write access to the DOM).
>
>So, I was quite on board when you said use an action, but to
>have a separate action that could set a UI layer sorting 
>property of a repeat or itemset is quite a nice idea.
>
>We already have UI layer state information and actions that
>manipulate the information, e.g. switch and toggle, repeat
>and setindex, so the precedent is there.  And we already have
>the issue of solving this state information problem in the
>iteration case, such as managing the repeat index for each
>instantiation of a repeat that is iterated by a containing repeat.
>
>Having a whole action will lead to more configurability, and
>I think the amount of configuration will be unavoidable, e.g.
>how to set up secondary keys and how to set up different kinds of
>comparisons such as numeric, lexicographic, ascending/descending.
>Or maybe just how to define the comparison function to be used,
>which would solve all of the above.
>  
>

Received on Wednesday, 20 April 2005 08:03:42 UTC