Implement function

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

Implement function

StephR
Hi again,

In a table, I list projects. I wish to give the User the possibility to sort dynamically the data in this table. I have succeeded with the exf:sort function with one column for a start.

Now I could just "copy-paste" the code for the header of every column, but let's say I would like to find a cleaner way to do so. In XSL, one can use

    <xsl:copy-of select="f:column('ProjectNo', 'ProjectNo', 'text')"/>

It calls a function that will get ready all the data and copy it back for the header. Is it possible to do the same? What would you do to not repeat code ? Here is what I have written for one header :

<xforms:group ref="instance('sorting-instance')">
    <xforms:group ref=".[SortBy = '@ProjectId']">
        <xforms:group ref=".[SortOrder = 'ascending']">
            <!-- We are in ascending order -->
            <xforms:trigger appearance="xxforms:image">
                <xxforms:img src="/design/images/sort-down.gif"/>
                <xforms:label/>
                <xforms:action ev:event="DOMActivate">
                    <xforms:setvalue ref="SortOrder">descending</xforms:setvalue>
                </xforms:action>
            </xforms:trigger>
        </xforms:group>
        <xforms:group ref=".[SortOrder != 'ascending']">
            <!-- We are in descending order -->
            <xforms:trigger appearance="xxforms:image">
                <xxforms:img src="/design/images/sort-up.gif"/>
                <xforms:label/>
                <xforms:action ev:event="DOMActivate">
                    <xforms:setvalue ref="SortOrder">ascending</xforms:setvalue>
                </xforms:action>
            </xforms:trigger>
        </xforms:group>
    </xforms:group>
    <xforms:group ref=".[SortBy != '@ProjectId']">
        <!-- Not sorted by this column -->
        <xforms:trigger appearance="xxforms:image">
            <xxforms:img src="/design/images/sort-natural.gif"/>
            <xforms:label/>
            <xforms:action ev:event="DOMActivate">
                <xforms:setvalue ref="sortOrder">ascending</xforms:setvalue>
                <xforms:setvalue ref="sortDataType"></xforms:setvalue>
                <xforms:setvalue ref="sortBy"></xforms:setvalue>
            </xforms:action>
        </xforms:trigger>
    </xforms:group>
</xforms:group>

The idea is that I call a own made function that will create dynamically the data above and "copy it back". Possible ?



--
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
Reply | Threaded
Open this post in threaded view
|

Re: Implement function

Alessandro Vernet
Administrator
Stephane,

On Jan 19, 2008 1:10 PM, Stephane Ruchet <[hidden email]> wrote:
>  Now I could just "copy-paste" the code for the header of every column, but
> let's say I would like to find a cleaner way to do so. In XSL, one can use
>
>      <xsl:copy-of select="f:column('ProjectNo', 'ProjectNo', 'text')"/>

Yes, creating an XSLT function seems reasonable in this case. I must
have done that a few times in the past to handle this very same
situation :).

Alex
--
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
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