Quantcast
Channel: C1 CMS Foundation - Open Source on .NET
Viewing all articles
Browse latest Browse all 2540

New Post: Using Paging from GetDataTemplateXML

$
0
0
If I understand you correctly, you want to:
  1. filter records by 'EmployeeName'
  2. and then, build the paging with the filtered items
If this is the case, you should use the Filter parameter on your GetTestimonialsTemplateXml function call and use FieldPredicatesFilter to filter the data items by 'EmployeeName'. You can use QueryStringValue to query an employee name in the URL.

To illustrate, below I'm making a function call to the built-in IPage data type,
filtering pages by TemplateId (Guid) and then doing the paging (2 items per page)

Then I can open an URL like this: http://www.mywebsite.com/Test?Page=2&TemplateId=9f096519-d21c-435e-b334-62224fde2ab3 - and get Page 2 of C1 pages (IPage) filtered by the Template specified with the GUID

The Function Call in the sample goes like this:
<functions>
    <f:function xmlns:f="http://www.composite.net/ns/function/1.0" name="Composite.Data.Types.IPage.GetIPageXml" localname="GetIPageXml">
        <f:param name="Filter">
            <f:function name="Composite.Data.Types.IPage.FieldPredicatesFilter">
                <f:param name="TemplateId">
                    <f:function name="Composite.Utils.Predicates.GuidEquals">
                        <f:param name="Value">
                            <f:function name="Composite.Web.Request.QueryStringGuidValue">
                                <f:param name="ParameterName" value="TemplateId" />
                                <f:param name="FallbackValue" value="ea2ca748-efbf-4d94-8e2a-11ce49b71cd5" />
                            </f:function>
                        </f:param>
                    </f:function>
                </f:param>
            </f:function>
        </f:param>
        <f:param name="PageSize" value="2" />
        <f:param name="PageNumber">
            <f:function name="Composite.Web.Request.QueryStringIntegerValue">
                <f:param name="ParameterName" value="Page" />
                <f:param name="FallbackValue" value="1" />
            </f:function>
        </f:param>
        <f:param name="IncludePagingInfo" value="False" />
        <f:param name="PropertyNames">
            <f:paramelement value="Id" />
            <f:paramelement value="Title" />
            <f:paramelement value="TemplateId" />
        </f:param>
    </f:function>
</functions>
The Function Template is:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:in="http://www.composite.net/ns/transformation/input/1.0"
    xmlns="http://www.w3.org/1999/xhtml"
    exclude-result-prefixes="xsl in">
    <xsl:template match="/">
        <html>
            <head/>
            <body>
                <div>
                    <xsl:apply-templates select="/in:inputs/in:result[@name='GetIPageXml']/IPage"/>
                </div>
            </body>
        </html>
    </xsl:template>
    <xsl:template match="/in:inputs/in:result[@name='GetIPageXml']/IPage">
        <a href="~/page({@Id})"><xsl:value-of select="@Title"/></a>, Template ID: <xsl:value-of select="@TemplateId"/><br/>
    </xsl:template>
</xsl:stylesheet>

Viewing all articles
Browse latest Browse all 2540

Trending Articles