I dont know what is the difference between Procedure/Widget in TiddlyWiki
but I use the Procedure to make list paging feature and its works fine
This is my first Procedure
If there is any shortcomings, please give me some suggestions.
first step, should add a new Tiddler for list paging Procedure
title: $:/MyProcedure/ListPaging
tag: $:/tags/Global
text:
\procedure list-paging(myfilter,datalimit)
<$vars dataTid=<<qualify"$:/temp/list-paging">>>
<$set name="dataRest" filter="[title<dataTid>get[text]multiply<datalimit>]">
<$list filter="[subfilter<myfilter>] +[rest<dataRest>limit<datalimit>]" variable="current" counter="counter">
<$set name="dataCnt" filter="[<counter>add<dataRest>]">
<<dataCnt>>: <$button class="tc-btn-invisible tc-tiddlylink">
<$action-navigate $to=<<current>> $scroll=yes/>
<<current>></$button><br/>
</$set>
</$list>
</$set>
<$list filter="[subfilter<myfilter>] +[count[]!match[0]]" emptyMessage="0 results">
<$set name="rangeEnd" filter="[subfilter<myfilter>] +[count[]divide<datalimit>untrunc[]subtract[1]]">
Go To Page: <$select tiddler=<<dataTid>> field="text" default="0">
<$list filter="[range[0],<rangeEnd>]" variable="current" counter="counter">
<option value=<<current>>><<counter>></option>
</$list>
</$select>
</$set>
</$list>
</$vars>
\end
then call it anywhere.
The example result is a list with paging every 20 items.
<<list-paging "[!is[system]sort[modified]reverse[]]" 20>>
my Procedure very usefui for large data
if the list more then 10000 items
it will not to show long results in page
and it can be use in custom input, like this:
Title: <$edit-text tiddler="$:/temp/MySearch" field="tempsearchtitle"/>
<$button>Search
<$action-setfield $tiddler="$:/temp/MySearch" searchtitle={{$:/temp/MySearch!!tempsearchtitle}} />
</$button><br />
<<list-paging "[search:title{$:/temp/MySearch!!searchtitle}] +[!is[system]sort[title]]" 25>>
but there is still a problem
when clicking the “Search” button doesn’t automatically go to page 1.
the “Search” button in outside of Procedure
I cant get the click evevnt to change page where inside of Procedure
I have no idea to solve the problem
maybe somebody can help me to solve it, then I will be grateful.