Table layout containing tiddlers with specific tag

140 views
Skip to first unread message

roger

unread,
Aug 12, 2015, 10:40:45 AM8/12/15
to TiddlyWiki
I've been utilizing TWc for several years, but am looking at possibly updating to TW5.  A feature I use in TWc is to generate a list of prior tiddlers in a table format, with the tiddler creation date, tiddler title, tiddler body and tiddler author.  The desired outcome is produced in TWc using a tiddler with the following content:

<script>
        var tag="faq";
        var hdr="| ''DATE'' | ''NOTE'' | ''AUTHOR'' |\n";
        var fmt="| %0 |''[[%1]]:'' <<tiddler [[%1]]>> | %2 |\n";
        var tids=store.getTaggedTiddlers("caseNote",'created').reverse(); 
        var out=[hdr];
        for (var i=0; i<tids.length; i++) {
                var when=tids[i].created.formatString("MM/DD/YYYY");
                var title=tids[i].title;
                var who=tids[i].modifier;
                out.push(fmt.format([when,title,who]));
        }
        return out.join('');
</script>
 
I tried using the script in a TW5 tiddler, but it doesn't work the same.  I assume the code works in TWc because of the inline javascript plugin.  Is that plugin available for TW5 or is there another way of accomplishing the same thing? 

~Roger

Jed Carty

unread,
Aug 12, 2015, 4:31:16 PM8/12/15
to TiddlyWiki
For TW5 you use a list widget and html tables like this:

<table>
<tr>
<th>
Title
</th>
<th>
Author
</th>
<th>
Date
</th>
</tr>
<$list filter='[tag[Wiki Examples]]'>
<tr>
<td>
{{!!title}}
</td>
<td>
{{!!modifier}}
</td>
<td>
{{!!created}}
</td>
</tr>
</$list>
</table>

It's not the same layout as your code gives, but it should show how to make tables like that.

roger

unread,
Aug 15, 2015, 3:20:01 AM8/15/15
to TiddlyWiki
Thanks Jed.
I'm really a novice when it comes to the new stuff in TW5. Is is possible to sort the list of tiddlers in reverse chronological order based on the date created?  I see in the List Widget section of tiddlywiki.com that there is a sort parameter that can be used when invoking the list widget, but can't find the syntax to get the list to sort in reverse.

A couple other things I'm not understanding.  How do I render {{!!title}} as a link to the tiddler, rather than just text or alternatively, add a link such as [[...edit|{{!!title}}]]?

Also, how do you control how the date is formatted?  The default output of {{!!created}} is way more detailed than I want to display.  I just need a simple MM/DD/YYYY format.

~Roger

ParisWiki

unread,
Aug 16, 2015, 4:39:39 AM8/16/15
to TiddlyWiki
For your last question :


Also, how do you control how the date is formatted?  The default output of {{!!created}} is way more detailed than I want to display.  I just need a simple MM/DD/YYYY format.

Just replace the line {{!!created}} by

<$view field="created" format="date" template="0DD/0MM/YYYY"/>

enjoy !

 

Jed Carty

unread,
Aug 16, 2015, 7:11:27 AM8/16/15
to TiddlyWiki
Adding ! before the name of a filter operator will reverse the operator. What this means is different is some situations but for sorting it reverses the order of the output.

To sort the tiddlers add sort[] to the list. Just sort[] will sort by title, sort[created] will sort chronologically by creation date and !sort[created] will sort in reverse chronological order. So to list the output in reverse chronological order the filter from my example would become [tag[Wiki Examples]!sort[created]]
To get {{!!title}} to render as a link you need to use the link widget because of how tiddlywiki renders things. Like this: <$link>{{!!title}}</$link>
If that gives you anything strange you can also use <$link to=<<currentTiddler>>><$view field='title'/></$link>

And it looks like ParisWiki got your last question.

roger

unread,
Aug 16, 2015, 5:15:28 PM8/16/15
to TiddlyWiki
Jed & ParisWiki
Thank you both. The table layout is looking very similar to what I'm accustomed to now.

I need to review the widget info on tiddlywiki.com to get a better understanding of TW5. Is there any other source of documentation recommended for a person to figure out simple tweaks like the ones I needed for my table layout?

Jed Carty

unread,
Aug 16, 2015, 5:27:51 PM8/16/15
to TiddlyWiki
There are many resources that are inconsistently updated. I have http://inmysocks.tiddlyspot.com/ which I try to update regularly. There is a community search but it may not have been updated in a while https://rawgit.com/erwanm/tw-aggregator/master/tw-community-search.html

I have a very incomplete list of other resources here.
Reply all
Reply to author
Forward
0 new messages