Login  Register

Re: how to get the correct item in the model, after sorting in a repeat

Posted by Erik Bruchez on Jun 04, 2009; 8:46pm
URL: https://discuss.orbeon.com/how-to-get-the-correct-item-in-the-model-after-sorting-in-a-repeat-tp43833p43835.html

Michael,

That's right, the index returned by index() is that of the resulting  
node-set, not that of the node-set before using exf:sort().

What you could do is redo the sorting in the delete action, something  
like this:

<xforms:delete ev:event="DOMActivate" at="index('N10028-repeat')"
   nodeset="ef:sort(instance('main-instance')/Calls/Call/
Servicerufnummern/SRN,'@ID','text'"/>

-Erik

On Jun 3, 2009, at 4:06 AM, Myxlyxl wrote:

>
> Hello,
>
> my problem:
>
> I use exf:sort to sort a repeat:
>
> <xforms:repeat
> nodeset="exf:sort(instance('main-instance')/Calls/Call/
> Servicerufnummern/SRN,'@ID','text')"
> id="N10028-repeat">
>
> </xforms:repeat>
>
> somewhere later (not in the above repeat) I have a trigger to delete  
> an
> element from the repeat:
>
> <xforms:trigger appearance="minimal">
> <xforms:action ev:event="DOMActivate">
> <xforms:delete at="index('N10028-repeat')" ev:event="DOMActivate"
> context="instance('main-instance')/Calls/Call/Servicerufnummern"
> nodeset="SRN" />
> </xforms:action>
> <xforms:label>
> /img/remove.gif
>        SRN
> </xforms:label>
> </xforms:trigger>
>
> The problem is, that index('N10028-repeat') doesnt provide the correct
> index. It gives me the correct index of the selected item, but this  
> is not
> the same as in the model because of the sort. Without sorting  
> everything
> works perfect.
>
> I also tried something like:
> count(instance('main-instance')/Calls/Call/Servicerufnummern/
> SRN[index('N10028-repeat')]/preceding-sibling::SRN)+1]
> , no luck either.
>
> Perhaps somebody has an idea how to get the correct index ?
>
> Thanks a lot
> Michael
>
> --
> View this message in context: http://www.nabble.com/how-to-get-the-correct-item-in-the-model%2C-after-sorting-in-a-repeat-tp23848200p23848200.html
> Sent from the ObjectWeb OPS - Users mailing list archive at  
> Nabble.com.
>
>
> --
> 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
> OW2 mailing lists service home page: http://www.ow2.org/wws
--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.com/



--
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
OW2 mailing lists service home page: http://www.ow2.org/wws