Discussion:
[tw] Using a filter in a list field for sorting purposes
Add Reply
Steven Schneider
2017-08-08 15:24:29 UTC
Reply
Permalink
Raw Message
Hi, I am writing a syllabus for my course, and have a set of tiddlers
tagged "Day" -- each has as a readable date as a title (i.e. Mon, Aug 28,
2017). I also want students to be able to navigate on a
first-previous-next-last through the class meeting tiddlers, so I created a
field called "sortable-date" which renders dates as 20170828, and thus can
be sorted.

When I view <<tag Day>> the tiddlers are sorted by title, of course. How do
I sort the tiddlers by sortable-date instead, when rendered in the <<tag
Day>> macro?

I tried putting this in the list field of Day: <$list
filter="[tag[Day]sort[sortable-date]]"/> but it didn't work.

And, I tried creating a tiddler {{sortable-dates}} which is a
space-separated ordered list of the tiddlers, and transcluding that tiddler
into the list field of [[Day]] but that didn't work either.

Seems there should be an option the specifies the sort order of tiddlers
matching a tag...so I must be missing something...

Thanks!

//steve.
--
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 tiddlywiki+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
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/871c69c4-7663-4e59-af85-8af90c7620d7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
'Mark S.' via TiddlyWiki
2017-08-08 16:24:49 UTC
Reply
Permalink
Raw Message
Well, the list mechanism specifies the ordering. So you could write a
button that you fire off once a semester to specify the ordering. (Assuming
the syllabus doesn't change during the semester, which would be evil)

Or you could hack your own tag button. If you make a template
$:/core/ui/TagTemplate2 like this:

\define list-tagged-draggable2(tag,itemTemplate,elementTag:"div")
<$set name="tag" value="""$tag$""">
<$list filter="[<tag>tagging[]sort[sortable-date]]">
<$elementTag$ class="tc-menu-list-item">
<$droppable actions=<<list-tagged-draggable-drop-actions>>>
<$elementTag$ class="tc-droppable-placeholder">
 
</$elementTag$>
<$elementTag$>
<$transclude tiddler="""$itemTemplate$""">
<$link to={{!!title}}>
<$view field="title"/>
</$link>
</$transclude>
</$elementTag$>
</$droppable>
</$elementTag$>
</$list>
<$tiddler tiddler="">
<$droppable actions=<<list-tagged-draggable-drop-actions>>>
<$elementTag$ class="tc-droppable-placeholder">
 
</$elementTag$>
<$elementTag$ style="height:0.5em;">
</$elementTag$>
</$droppable>
</$tiddler>
</$set>
\end
<span class="tc-tag-list-item">
<$set name="transclusion" value=<<currentTiddler>>>
<$macrocall $name="tag-pill-body" tag=<<currentTiddler>> icon={{!!icon}}
colour={{!!color}} palette={{$:/palette}} element-tag="""$button""" element-
attributes="""popup=<<qualify "$:/state/popup/tag">>
dragFilter='[all[current]tagging[]]' tag='span'"""/>
<$reveal state=<<qualify "$:/state/popup/tag">> type="popup" position=
"below" animate="yes" class="tc-drop-down">
<$transclude tiddler="$:/core/ui/ListItemTemplate"/>
<$list filter=
"[all[shadows+tiddlers]tag[$:/tags/TagDropdown]!has[draft.of]sort[sortable-date]]"
variable="listItem">
<$transclude tiddler=<<listItem>>/>
</$list>
<hr>
<$macrocall $name="list-tagged-draggable2" tag=<<currentTiddler>>/>
</$reveal>
</$set>
</span>
Enter code here...

and then create and invoke a new macro like:

\define tag2(tag)
{{$tag$||$:/core/ui/TagTemplate2}}
\end


<<tag2 mytag>>


Then the default ordering will be by sortable-date. Since the list is
draggable , you can still rearrange the tiddlers as you want.

HTH
Mark
Post by Steven Schneider
Hi, I am writing a syllabus for my course, and have a set of tiddlers
tagged "Day" -- each has as a readable date as a title (i.e. Mon, Aug 28,
2017). I also want students to be able to navigate on a
first-previous-next-last through the class meeting tiddlers, so I created a
field called "sortable-date" which renders dates as 20170828, and thus can
be sorted.
When I view <<tag Day>> the tiddlers are sorted by title, of course. How
do I sort the tiddlers by sortable-date instead, when rendered in the <<tag
Day>> macro?
I tried putting this in the list field of Day: <$list
filter="[tag[Day]sort[sortable-date]]"/> but it didn't work.
And, I tried creating a tiddler {{sortable-dates}} which is a
space-separated ordered list of the tiddlers, and transcluding that tiddler
into the list field of [[Day]] but that didn't work either.
Seems there should be an option the specifies the sort order of tiddlers
matching a tag...so I must be missing something...
Thanks!
//steve.
--
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 tiddlywiki+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
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/aabfe21d-4376-4c5e-a520-0bfb1935a274%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
stevesuny
2017-08-10 20:19:28 UTC
Reply
Permalink
Raw Message
Thanks, Mark. I think the first mechanism is better for me :) but I
appreciate the hack. It is pretty cool....i haven't used droppable yet,
looks interesting....//steve.
Post by 'Mark S.' via TiddlyWiki
Well, the list mechanism specifies the ordering. So you could write a
button that you fire off once a semester to specify the ordering. (Assuming
the syllabus doesn't change during the semester, which would be evil)
Or you could hack your own tag button. If you make a template
\define list-tagged-draggable2(tag,itemTemplate,elementTag:"div")
<$set name="tag" value="""$tag$""">
<$list filter="[<tag>tagging[]sort[sortable-date]]">
<$elementTag$ class="tc-menu-list-item">
<$droppable actions=<<list-tagged-draggable-drop-actions>>>
<$elementTag$ class="tc-droppable-placeholder">
&nbsp;
</$elementTag$>
<$elementTag$>
<$transclude tiddler="""$itemTemplate$""">
<$link to={{!!title}}>
<$view field="title"/>
</$link>
</$transclude>
</$elementTag$>
</$droppable>
</$elementTag$>
</$list>
<$tiddler tiddler="">
<$droppable actions=<<list-tagged-draggable-drop-actions>>>
<$elementTag$ class="tc-droppable-placeholder">
&nbsp;
</$elementTag$>
<$elementTag$ style="height:0.5em;">
</$elementTag$>
</$droppable>
</$tiddler>
</$set>
\end
<span class="tc-tag-list-item">
<$set name="transclusion" value=<<currentTiddler>>>
<$macrocall $name="tag-pill-body" tag=<<currentTiddler>> icon={{!!icon}}
colour={{!!color}} palette={{$:/palette}} element-tag="""$button"""
element-attributes="""popup=<<qualify "$:/state/popup/tag">>
dragFilter='[all[current]tagging[]]' tag='span'"""/>
<$reveal state=<<qualify "$:/state/popup/tag">> type="popup" position=
"below" animate="yes" class="tc-drop-down">
<$transclude tiddler="$:/core/ui/ListItemTemplate"/>
<$list filter=
"[all[shadows+tiddlers]tag[$:/tags/TagDropdown]!has[draft.of]sort[sortable-date]]"
variable="listItem">
<$transclude tiddler=<<listItem>>/>
</$list>
<hr>
<$macrocall $name="list-tagged-draggable2" tag=<<currentTiddler>>/>
</$reveal>
</$set>
</span>
Enter code here...
\define tag2(tag)
{{$tag$||$:/core/ui/TagTemplate2}}
\end
<<tag2 mytag>>
Then the default ordering will be by sortable-date. Since the list is
draggable , you can still rearrange the tiddlers as you want.
HTH
Mark
Post by Steven Schneider
Hi, I am writing a syllabus for my course, and have a set of tiddlers
tagged "Day" -- each has as a readable date as a title (i.e. Mon, Aug 28,
2017). I also want students to be able to navigate on a
first-previous-next-last through the class meeting tiddlers, so I created a
field called "sortable-date" which renders dates as 20170828, and thus can
be sorted.
When I view <<tag Day>> the tiddlers are sorted by title, of course. How
do I sort the tiddlers by sortable-date instead, when rendered in the <<tag
Day>> macro?
I tried putting this in the list field of Day: <$list
filter="[tag[Day]sort[sortable-date]]"/> but it didn't work.
And, I tried creating a tiddler {{sortable-dates}} which is a
space-separated ordered list of the tiddlers, and transcluding that tiddler
into the list field of [[Day]] but that didn't work either.
Seems there should be an option the specifies the sort order of tiddlers
matching a tag...so I must be missing something...
Thanks!
//steve.
--
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 tiddlywiki+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
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/f675e83c-c04e-4398-ab60-27f562ad7fdc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...