Simple DataTable Paging Example

In this example, we create a cached datatable that we will use for paging.

The skiprows and maxrows parameters of the format macro are set using the state of the paging macro.

Smartsite SXML CopyCode image Copy Code
<se:cache save="key = this.getcachekey()" resulttype="none" >
    <se:xlinks resulttype="datatable" parent="SAMPLEDATA"/>
</se:cache>
 
<se:paging 
    id="paging" 
    inputdata="key"
    pagesize="5"
/>
 
<se:format inputdata="key"
    maxrows="{page.paging.size()}"
    skiprows="{page.paging.skip()}"  >
    <se:rowformat>
        <li><a href="{this.location()}">{this.field(title)}</a></li>
    </se:rowformat>
    <se:resultformat>
        <ul>{this.result()}</ul>
    </se:resultformat>
</se:format>
 
<span class="navbar">
    {page.paging.goto(First)} 
    {page.paging.goto(Previous)}
    {page.paging.goto(Next)}
    {page.paging.goto(Last)}
    {page.paging.current()} / {page.paging.count()}
</span>