Manipulating the order of elements

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Manipulating the order of elements

Duane Gran
While XForms doesn't support this functionality, I'm curious if it is  
possible to control the order of the elements in an XML file.  In  
other words, if a document was as such:

<root>
  <a/>
  <b/>
  <c/>
</root>

The UI would present input fields for each of these in the same order  
and have a facility to reorder the resulting instance document as  
follows:

<root>
  <c/>
  <a/>
  <b/>
</root>

I realize this contradicts one of the goals of XForms to separate the  
display from the data, but for my particular application it is  
important to my client to control element ordering.  I imagine two  
ways visually to express this:

1) Easy - place up/down arrows next to each form control
2) Hard - support drag & drop via ajax to reorder elements

I suspect that XUpdate might be the technology to pull this off.  Has  
anyone done anything like this?  Does it seem technically possible to  
pull it off using OPS?

Duane Gran



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Manipulating the order of elements

Alexander Žaťko
You can describe structure of your page in a separate XML, or as
another branch in your instance XML. Granted, you will have to do more
work because you are decoupling data from presentation, but in the long
run it is a good think.

A.

On Dec 16, 2005, at 11:49 AM, Duane Gran wrote:

> While XForms doesn't support this functionality, I'm curious if it is
> possible to control the order of the elements in an XML file.  In
> other words, if a document was as such:
>
> <root>
>  <a/>
>  <b/>
>  <c/>
> </root>
>
> The UI would present input fields for each of these in the same order
> and have a facility to reorder the resulting instance document as
> follows:
>
> <root>
>  <c/>
>  <a/>
>  <b/>
> </root>
>
> I realize this contradicts one of the goals of XForms to separate the
> display from the data, but for my particular application it is
> important to my client to control element ordering.  I imagine two
> ways visually to express this:
>
> 1) Easy - place up/down arrows next to each form control
> 2) Hard - support drag & drop via ajax to reorder elements
>
> I suspect that XUpdate might be the technology to pull this off.  Has
> anyone done anything like this?  Does it seem technically possible to
> pull it off using OPS?
>
> Duane Gran
> --
> You receive this message as a subscriber of the
> [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Manipulating the order of elements

Erik Bruchez
Administrator
In reply to this post by Duane Gran
Duane Gran wrote:
 > While XForms doesn't support this functionality, I'm curious if it is
 > possible to control the order of the elements in an XML file.  In  other
 > words, if a document was as such:
 >
 > <root>
 >  <a/>
 >  <b/>
 >  <c/>
 > </root>
 >
 > The UI would present input fields for each of these in the same order
 > and have a facility to reorder the resulting instance document as
follows:
 >
 > <root>
 >  <c/>
 >  <a/>
 >  <b/>
 > </root>

If the scenario is as simple as the above, you can get by with:

<xforms:insert nodeset="/root/*" at="1"/>
<xforms:delete nodeset="/root/*" at="last()"/>

In the general case things become more complex! One issue I see is
that you can only use the last element of a homogeneous collection as
template, so you can't directly move the first element to the end, for
example. But you could move all the other elements to the first
position instead. Something to explore.

 > I realize this contradicts one of the goals of XForms to separate
 > the display from the data, but for my particular application it is
 > important to my client to control element ordering.

I think this is a completely legitimate use of XForms.

 > I imagine two ways visually to express this:
 >
 > 1) Easy - place up/down arrows next to each form control

Quite doable.

 > 2) Hard - support drag & drop via ajax to reorder elements

Yes, we would need to improve the OPS widgets to get there. It'd be
good to start with 1) first.

 > I suspect that XUpdate might be the technology to pull this off.
 > Has anyone done anything like this?  Does it seem technically
 > possible to pull it off using OPS?

That's right, you can submit your XForms instance with an XForms
submission, passing enough information as to how elements must be
reordered, then performed the reordering in XSLT or XUpdate (called
from XPL), and return the reordered instance.

-Erik




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws