Hi Stephen,
Thanks a lot: it works just fine.
I guess I should have figured out something like this myself ….
Since the buttons showed up if there were any siblings at all, I added a
condition to ensure that they only showed up if the siblings had the same name
- if the repetition can actually be moved up or down.
<xf:group ref="preceding-sibling::*[1][self::mods:name]">
<xf:trigger>
<xf:label>Move Up</xf:label>
<xf:action ev:event="DOMActivate">
<xf:insert nodeset="self::*"
origin="following-sibling::*[1]" position="before"/>
<xf:delete nodeset="following-sibling::*[1]"/>
</xf:action>
</xf:trigger>
</xf:group>
<xf:group ref="following-sibling::*[1][self::mods:name]">
<xf:trigger>
<xf:label>Move Down</xf:label>
<xf:action ev:event="DOMActivate">
<xf:insert nodeset="self::*"
origin="preceding-sibling::*[1]" position="after"/>
<xf:delete nodeset="preceding-sibling::*[1]"/>
</xf:action>
</xf:trigger>
</xf:group>
Thanks again!
Best,
Jens
On Dec 6, 2012, at 1:15 AM, Stephen Cameron <[email protected]> wrote:
> one approach.
> repeats need a dynamic sort capability, is this in Xforms 2.0?
>
> <xf:group ref="instance('xyz')/*[index('repeat_id')]>
>
> <xf:group ref="preceding-sibling::*[1]">
> <xf:trigger>
> <xf:label>Move Up</xf:label>
> <xf:action ev:event="DOMActivate">
> <xf:insert nodeset="self::*"
> origin="following-sibling::*[1]" position="before"/>
> <xf:delete
> nodeset="following-sibling::*[1]"/>
> </xf:action>
> </xf:trigger>
> </xf:group>
> <xf:group ref="following-sibling::*[1]">
> <xf:trigger>
> <xf:label>Move Down</xf:label>
> <xf:action ev:event="DOMActivate">
> <xf:setvalue
> ref="instance('temp')/s2x:posn" value="index('element_details')"/>
> <xf:insert nodeset="self::*"
> origin="preceding-sibling::*[1]" position="after"/>
> <xf:delete
> nodeset="preceding-sibling::*[1]"/>
> <xf:setindex
> repeat="element_details" index="instance('temp')/s2x:posn + 1"/>
> </xf:action>
> </xf:trigger>
> </xf:group>
> <xf:trigger>
> <xf:label>Delete</xf:label>
> <xf:delete ev:event="DOMActivate"
> nodeset="current()"/>
> </xf:trigger>
> </xf:group>
>
>
> On Thu, Dec 6, 2012 at 2:35 AM, Jens Østergaard Petersen <[email protected]>
> wrote:
> Hi,
>
> Sometimes, if you have a repeat, you wish to be able to move the repetitions
> up or down, for instance arranging names in some meaningful order. I have
> seen code for this somewhere, but I can't find it again. Does anyone have
> something like this lying around?
>
> Thanks in advance for any assistance,
>
> Jens
> ------------------------------------------------------------------------------
> LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
> Remotely access PCs and mobile devices and provide instant support
> Improve your efficiency, and focus on delivering more value-add services
> Discover what IT Professionals Know. Rescue delivers
> http://p.sf.net/sfu/logmein_12329d2d
> _______________________________________________
> Xsltforms-support mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/xsltforms-support
>
------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Xsltforms-support mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xsltforms-support