[TW5] Super simple button to cycle

75 views
Skip to first unread message

Mat

unread,
Mar 9, 2016, 5:11:58 AM3/9/16
to TiddlyWiki
Matabeles recent work on listops inspired me to make an attempt at a cycle button, i.e a button to toggle e.g "a - b - c - a - b ..."

I was surprised at how compact it turned out with listops so just thought I'd share it. Sorry if I'm sharing something totally obvious but I think the solutions I've seen so far have been more complex.

title:MyList
text
:a b c


...and in some other(!) tiddler

<$button>
<$action-listops $tiddler="MyList" $field="text" $filter={{MyList}} $subfilter="+[putlast[]]"/>
<$list filter="[list[MyList!!text]first[]]"><$view field="title"/></$list>
</$button>


Again, sorry if obvious.

<:-)





Matabele

unread,
Mar 9, 2016, 12:34:13 PM3/9/16
to TiddlyWiki
Hi Mat

I've since added a cycle[] filter operator to the x-listops filters to make this even easier. This isn't part of the core -- you'll need to copy over the version of $:/core/modules/filters/x-listops.js from here.

There's a couple of demos on the listops wiki to illustrate it's use -- without and with the use of the keep[] filter operator. This allows the cycling of multiple lists of items within one list field.

regards
Reply all
Reply to author
Forward
0 new messages