W3C home > Mailing lists > Public > www-forms@w3.org > April 2005

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

From: Suzan Foster <suzan.foster@nerocmediaware.nl>
Date: Wed, 20 Apr 2005 10:03:18 +0200
Message-ID: <42660CC6.8060604@nerocmediaware.nl>
To: John Boyer <JBoyer@PureEdge.com>
CC: tvraman@almaden.ibm.com, mark.birbeck@x-port.net, Leigh.Klotz@xerox.com, www-forms@w3.org

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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 10 March 2012 06:22:00 GMT