I have developed a* list-pages* macros similar to list-links, but it is a
little lengthy

\define list-pages(filter, entries-per-page:5, template,
stateTid:"pagingTid")
<$vars stateTid=<<qualify xx$/state/$stateTid$>> >
<$vars total-entries={{{ [subfilter<__filter__>count[]] }}}
page-number={{{[<stateTid>get[text]] ~[[1]]}}} >
<$vars low={{{[<page-number>subtract[1]multiply<__entries-per-page__>]}}}
       high={{{[<page-number>multiply<__entries-per-page__>]}}} >

<!-- create nav buttons --->
<$list filter="[<page-number>compare:number:lt[2]then[yes]else[no]]"
variable=state>
<$button disabled=<<state>> >Prev
<$action-listops $tiddler=<<stateTid>> $field=text
$subfilter="+[subtract[1]] ~[[1]]"/>
</$button>
</$list>
<$list filter="[<high>compare:number:gteq<total-entries>then[yes]else[no]]"
variable=state>
<$button disabled=<<state>>>Next
<$action-listops $tiddler=<<stateTid>> $field=text $subfilter="+[add[1]]
~[[2]]"/>
</$button>
</$list>

Displaying <$text text={{{[<low>add[1]]}}}/> through <<high>> of
<<total-entries>> Results

<$list filter="[subfilter<__filter__>first<high>]
-[subfilter<__filter__>first<low>]" template=<<__template__>> />

</$vars>
</$vars>
</$vars>
\end


It accepts:
* any Tiddlywiki filter or filter combinations
* it accepts template (so it is very powerful in creating different outputs
* can be used in a tiddler several times (has stateTid)
* number of output per page can be set

This macro can be hacked and used for situations where you have too many
outputs. Paging prevents a long output and hence slows down TW performance!

*Evaluations*
To give a try, download attached JSON and drag and drop into
https://tiddlywiki.com/
Look at the Test tiddler
As an example a simple template was created for test purposes.

*Question:*
What simpler solution do you propose?
What improvement do you suggest?


Best wishes
Mohammad

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/CAAV1gMCnbQn3RNd25WGU9_K%3DiayBf5mWy%2BvmU%3DxgDwPwKgT1rg%40mail.gmail.com.

Attachment: list-page-macro-with-example.json
Description: application/json

Reply via email to