Hi, how do I create custom pagination in list view instead of the standard couch pagination in list-view. Having a hard time doing that.
Normally the <cms:paginator> tag is used as a self-closing tag e.g.
- Code: Select all
<cms:paginator adjacents='1' />
The self-closing tag above outputs the full markup of the paginator and you can then tweak the CSS to make it gel with your markup.
However, for use-cases where you need finer control over the paginator's HTML markup, you can use the cms:paginator tag as a 'tag-pair' e.g.
- Code: Select all
<cms:paginator adjacents='1'>
...
</cms:paginator>
Used as a tag-pair, the tag makes available the following Couch variables that you can then use to craft your own paginator -
- Code: Select all
k_crumb_type // one of these 4: 'next', 'prev', 'ellipsis' or 'page'
k_crumb_disabled // pertinent for only 'next' and 'prev'
k_crumb_current // pertinent for only 'page'
k_crumb_link
k_crumb_text
As a working example, following snippet has been taken from the code used by Couch v2.0 admin-panel itself (couch/theme/_system/paginator.html) -
- Code: Select all
<div class="btn-group">
<cms:paginator adjacents='1'>
<cms:if k_crumb_type='prev' >
<a class="btn btn-pg pg-prev tt<cms:if k_crumb_disabled> disabled</cms:if>" <cms:if k_crumb_disabled>href="#" onClick="return false"<cms:else />href="<cms:show k_crumb_link />"</cms:if> title="Previous"><cms:show_icon 'arrow-thick-left' /></a>
</cms:if>
<cms:if k_crumb_type='ellipsis' >
<a class="btn btn-pg disabled" href="#" onClick="return false">…</a>
</cms:if>
<cms:if k_crumb_type='page' >
<cms:if k_crumb_current>
<a class="btn btn-pg btn-primary tt" href="#" onClick="return false" title="<cms:show k_crumb_text />"><cms:show k_crumb_text /></a>
<cms:else />
<a class="btn btn-pg tt" href="<cms:show k_crumb_link />" title="<cms:show k_crumb_text />"><cms:show k_crumb_text /></a>
</cms:if>
</cms:if>
<cms:if k_crumb_type='next' >
<a class="btn btn-pg pg-next tt<cms:if k_crumb_disabled> disabled</cms:if>" <cms:if k_crumb_disabled>href="#" onClick="return false"<cms:else />href="<cms:show k_crumb_link />"</cms:if> title="Next"><cms:show_icon 'arrow-thick-right' /></a>
</cms:if>
</cms:paginator>
</div>
You may take it as a reference to create yours.
Hope it helps.