[TW5] Strange behaviour for the "move" operator (ActionListopsWidget)

74 views
Skip to first unread message

FrD

unread,
Feb 16, 2017, 8:18:45 AM2/16/17
to TiddlyWiki
Hi,

I've got a problem when using the "move" extended filter operator.

Create a tiddler on http://tiddlywiki.com/, with a field named "items" containing "a b c d e".

Then put this code inside the tiddler :

\define filter() [list[!!items]] +[move:-1[$(it)$]]

<$list filter="[list[!!items]]" variable="it">

<<it>> <$button>
<$action-listops $field="items" $subfilter=<<filter>>/>
Up
</
$button>
</$list>

Then click on the "Up" button next to "a", "a" goes between "d" and "e".
That does note seem to be right. It should go at the end of the list or shouldn't move at all (?)
If anyone could have a look ... Thanks !

Regards

FrD



Matthew Lauber

unread,
Feb 16, 2017, 8:46:18 AM2/16/17
to TiddlyWiki
@FrD, I ran into this and submitted a PR.  https://github.com/Jermolene/TiddlyWiki5/pull/2658  It's fixed on the prerelease branch (http://tiddlywiki.com/prerelease/) but hasn't made it to the production site yet.

FrD

unread,
Feb 16, 2017, 9:01:26 AM2/16/17
to TiddlyWiki
Hi Matthew,

Thanks for your answer !

Regards

FrD

PMario

unread,
Feb 16, 2017, 9:43:07 AM2/16/17
to TiddlyWiki

Hi FrD,

Don't show the button, if you don't want to click it ;)



\define subfilter() [list[!!items]] +[move:-1[$(it)$]]

\define upButton()
<$list filter="[list[!!items]first[]] -$(it)$" variable=ignore emptyMessage=''><$button><$action-listops $field="items" $subfilter=<<subfilter>>/>Up</$button></$list>
\end


<$list filter="[list[!!items]]" variable="it">

<<it>> <<upButton>>
</$list>


have fun!
mario

PMario

unread,
Feb 16, 2017, 9:45:27 AM2/16/17
to TiddlyWiki
Hi,

The point for me is ... If the button is there, I actually want it to do something.

-m

Matthew Lauber

unread,
Feb 16, 2017, 10:21:00 AM2/16/17
to TiddlyWiki
That's a good UX point.  

FrD

unread,
Feb 16, 2017, 11:17:56 AM2/16/17
to TiddlyWiki
Hi Mario,

Thanks a lot for this code. I'll make good use of it (and for a "down" button too !).
I looked at http://tiddlywiki.com/ and couldn't find some doc about

variable=ignore

in the list widget or elsewhere. What is the effect of this declaration, preserve <<currentTiddler>>  without having to declare another variable ?

Regards

FrD

Matthew Lauber

unread,
Feb 16, 2017, 11:25:49 AM2/16/17
to tiddl...@googlegroups.com
Take a look at this:  http://tiddlywiki.com/static/ListWidget

The variable property sets the name of the variable that the list widget will store it's value in.  By default it sets the variable to "currentTiddler" overriding the current value of "currentTiddler".  In mario's code, it sets a variable named "ignore", so if inside the loop you added "<<ignore>>" you'd see the current value of the list widget.  But since you don't use that variable, it's just a convenient way to avoid overriding the "currentTiddler" variable.

FrD

unread,
Feb 16, 2017, 11:31:31 AM2/16/17
to TiddlyWiki
Hi Matthew,

Ok I see. I thought it was some special keyword since I always put the variable name between quotes !

Regards

FrD


Le jeudi 16 février 2017 17:25:49 UTC+1, Matthew Lauber a écrit :
The variable property sets the name of the variable that the list widget will store it's value in.  By default it sets the variable "currentTiddler" overriding the current value of "currentTiddler".  In mario's code, it sets a variable named "ignore", so if inside the loop you added "<<ignore>>" you'd see the current value of the list widget.  But since you don't use that variable, it's just a convenient way to avoid overriding the "currentTiddler" variable.

PMario

unread,
Feb 16, 2017, 1:40:41 PM2/16/17
to TiddlyWiki
On Thursday, February 16, 2017 at 5:17:56 PM UTC+1, FrD wrote:
I looked at http://tiddlywiki.com/ and couldn't find some doc about

variable=ignore

It's the same as variable=it ;) ... just a different name. sry for the confusion.

-m
Reply all
Reply to author
Forward
0 new messages