Hi,

Can't quite seem to figure this one out on my own...

Is there any way to change the "index" number of multiple objects of
the same class attached to a page?

I have a custom class with a number of properties, and a document with
a number of instances of that class attached. I then have some custom
display code on the Class Sheet which loops through all objects of the
custom class to display them in order. The problem is that this is
limited to displaying them in the order they were created.

When I use the class editor on the page, I get the list:

TestClass 0: Name
TestClass 1: Name
TestClass 2: Name

etc....

The velocity loop which does the displaying always returns the objects
in that order - 0,1, 2, etc....

#set($objs = $doc.getObjects('Admin.TestClass'))
#foreach($obj in $objs)

   < do some custom display stuff with each $obj >

#end

Is it possible to programmatically change the order of these objects?

Ultimately, I would like for the user to be able to drag and drop the
order of objects to manually set the display order in a persistent way
- much like the built-in Class Editor does for re-ordering multiple
properties of a class.

One workaround I have thought of is to include a property of the
custom Class for something like "sort order" and then allow the user
to modify this property, while leaving the underlying index order
untouched. This seems clunky to me, though...

Any thoughts?

As always, help is much appreciated.

Aaron
_______________________________________________
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to