Problem: sort does not work in a filter

59 views
Skip to first unread message

Surya

unread,
Oct 16, 2019, 8:41:20 PM10/16/19
to TiddlyWiki
Hello,

I have a very nice Search by multiple tags, which works really good.
The filter-results I want to be sorted by the field "timestamp". But that doesn't work- it is always sorted by title. I don't understand why.
I tried to write the sort="timestamp" before the template="$:/core/ui/ListItemTemplate 2" and I tried it with different brackets and without the ". But that all didn't help.
This is the code (without all the checkboxes for all the tags- because that's a lot, and I think, you don't need that part of the code, to tell me, why

<div style="text-align:center;line-height:0.8em;font-size:1.7em;">
<$button>
<$wikify name="searchterm" text='[<$list filter="[[$:/temp/tagsforfiltering]indexes[]]"><$list filter="[[$:/temp/tagsforfiltering]getindex
<currentTiddler>]" variable="tagfound">tag[<<tagfound>>]</$list></$list>]{{$:/temp/advancedsearchtagfilter!!ratingfilter}}'>
<$action-setfield $tiddler="$:/temp/advancedsearchtagfilter" text=<
<searchterm>>/>
@@background:olivedrab;&nbsp;''Search''&nbsp;@@
</$wikify>
<$wikify name="tagsforfiltering" text='Chosen Tags<$list filter="[[$:/temp/tagsforfiltering]indexes[]]"><$list filter="[[$:/temp/tagsforfiltering]getindex
<currentTiddler>]" variable="tagfound">  <<tagfound>></$list></$list>{{$:/temp/advancedsearchtagfilter!!ratingfilter}}: '>
<$action-setfield $tiddler="$:/temp/advancedsearchtagfilter" tagsforfiltering=<
<tagsforfiltering>>/>
</$wikify>

</$button>
<$button>
<$action-deletetiddler $tiddler="$:/temp/tagsforfiltering"/>
<$action-deletetiddler $tiddler="$:/temp/advancedsearchtagfilter"/>
@@background:orange;&nbsp;Reset&nbsp;@@
</$button>
</div><br/>


Found Tiddlers:
<$count filter={{$:/temp/advancedsearchtagfilter}} template="$:/core/ui/ListItemTemplate"/>

<$button>@@background:olivedrab;Open all found tiddlers@@
<$list filter={{$:/temp/advancedsearchtagfilter}}>
<$action-navigate $to=<
<currentTiddler>> $scroll=no/>
</$list>
</$button>
<br/><br/>

<$reveal type="nomatch" state="$:/temp/advancedsearchtagfilter" text="[]">
{{$:/temp/advancedsearchtagfilter!!tagsforfiltering}}
<$list filter={{$:/temp/advancedsearchtagfilter}} template="$:/core/ui/ListItemTemplate 2" sort="timestamp"/>
</$reveal>
<$reveal type="match" state="$:/temp/advancedsearchtagfilter" text="[]">

No tags selected.</$reveal>

Please could you help me with this.
If you have questions about anything, please ask.
Thank you,
Surya

Mark S.

unread,
Oct 16, 2019, 10:53:58 PM10/16/19
to TiddlyWiki

AFAIK, the list widget doesn't have a "sort" attribute. You have to add the sort as a filter operator, usually at the end of your filter run.

.. filter="[tags[stuff]sort[timestamp]]" ...

or possibly as a separate run

... filter="[tags[stuff]specialoperators[stuff]]  +[sort[timestamp]]" ...

I'm assuming in this that you actually have a field "timestamp".

Good luck!

Surya

unread,
Oct 17, 2019, 2:38:59 PM10/17/19
to TiddlyWiki

Thanks Mark!
Reply all
Reply to author
Forward
0 new messages