How to sort open tiddlers?

I have a set of tiddlers open.

image

How do I make TiddlyWiki to sort these in ascending or descending order?

Now I can sort the tiddlers in a filter using

[[$:/StoryList]get[list]!sort[]]

But how do I add button (or some other way) that I can use to sort and overwrite the list of $:/StoryList?

The ActionSetFieldWidget is used to set field, which is what you want to do. I think this should work;

<$button>
<$let order={{{ [[$:/StoryList]get[list]!sort[]] }}} >
<$action-setfield $tiddler="$:/StoryList" list=<<order>> />
</$let>
Sort
</$button>

If that doesn’t work, then maybe it works with a $set instead of $let.

1 Like

Remember the open tiddlers tab is a dragable list, you can change the order with drag. Also there are settings that alter where tiddlers are opened. So by sorting the actual story river it will quickly have its order disrupted.

Depending on why you want this, perhaps consider an additional sidebar tab that lists open story tiddlers in another order, but does not changed the list. Perhaps include a button to save the order when wanted.

1 Like

Thank you for your responses @twMat and @TW_Tones.

My filter was incorrect. :x:

I need to use enlist operator. :white_check_mark:

[enlist{$:/StoryList!!list}sort[]]

Problem is when I try to write it to the $:/StoryList field, it only writes the first tiddler $:/AdvancedSearch. This is because enlist creates a list.

So I need a way to convert the output of enlist back to a Title List.

Try this:

[enlist{$:/StoryList!!list}sort[]format:titlelist[]join[ ]]

Notes:

  • format:titlelist[] is applied to each title to add doubled square brackets if the title contains spaces
  • join[ ] merges all titles into a single string containing a space-separated list of items
1 Like