This may be the exorcise solution by Mark:

\define tagsort(mainTag, label:"Sort Tags", order:"ascend") 
<$button>$label$
<$reveal type="match" default="ascend" text=<<__order__>> >
<$action-listops  $tiddler=<<__mainTag__>>  $filter=
"[tag<__mainTag__>sortan[]]"/>
</$reveal>
<$reveal type="nomatch" default="ascend" text=<<__order__>> >
<$action-listops  $tiddler=<<__mainTag__>> 
 $filter="[tag<__mainTag__>!sortan[]]"/>
</$reveal>
</$button>
\end



   - It gets a main tag to sort based on that.
   - It can sort in ascending or descending order
   - It has the button inside and gets a label to be more semantic


--Mohammad

On Friday, February 8, 2019 at 8:05:10 AM UTC+3:30, Mark S. wrote:
>
> When you click on a tag and see a list, and then drag an item in the list, 
> where is that sort-order stored? It's stored in the "list" field of the 
> tiddler with the same name as the master tag that you clicked on. So, for 
> instance, if you go to TiddlyWiki.com and open the HelloThere tiddler, and 
> look at the "list" field, you will see the tiddlers that reference 
> "HelloThere" listed in the field. They are not in alphabetical order.
>
> If you copy the following into a tiddler at TiddlyWiki.com, and press the 
> "Sort" button, the corresponding tiddlers will be sorted:
>
> \define alphasort() <$action-listops $tidd ler="HelloThere" $subfilter=
> "+[sort[]]"/>
>
> <$button actions=<<alphasort>>
> Sort "HelloThere"
> </$button>
>
> You can make changes to this code to sort the list field of any tiddler.
>
> The catch is, that there is no requirement that all tiddlers that are 
> tagged by a tiddler are listed in its list field. This version will 
> populate the field AND sort it:
>
> \define alphasort() <$action-listops $tiddler="HelloThere" $filter=
> "[tag[HelloThere]sort[]]"/>
>
> <$button actions=<<alphasort>>>
> Sort "HelloThere"
> </$button>
>
>
> It's left as an exercise to the student to turn the code into a generic 
> macro that can be used on any tiddler ;-)
>
> -- Mark
>
>
> On Thursday, February 7, 2019 at 1:40:50 PM UTC-8, talha131 wrote:
>>
>> Tag macro which is shown at two places.
>>
>> 1. Tag manager 
>> 2. Under the tiddler title
>>
>> It shows a list of tiddlers. How do I sort them by title? It can be done 
>> manually using drag and drop. But can it be done automatically?
>>
>

-- 
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 post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/f4c83331-7e63-41fe-82a5-9faa5156fcc8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to