Login  Register

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

Posted by Alessandro Vernet on Jun 06, 2009; 1:23am
URL: https://discuss.orbeon.com/how-to-get-the-correct-item-in-the-model-after-sorting-in-a-repeat-tp43833p43836.html

Michael,

Erik Bruchez wrote
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'"/>
And if you want to avoid repeating that expression, you can use a variable:

<xxforms:variable name="sorted-nodeset" select="exf:sort(instance('main-instance')/Calls/Call/Servicerufnummern/SRN,'@ID','text')"/>
<xforms:repeat nodeset="$sorted-nodeset" id="N10028-repeat">
    <xforms:trigger appearance="minimal">
        <xforms:action ev:event="DOMActivate">
            <xforms:delete at="index('N10028-repeat')" ev:event="DOMActivate"
                           nodeset="$sorted-nodeset"/>
        </xforms:action>
    </xforms:trigger>
</xforms:repeat>

Alex