Need Help: List Item Template - Generate Reports

One the most important, useful and yet commonly used widget is $list.
Using $list one can make queries and generate simple reports, but $list can accept a template as input parameter and then one can generate very sophisticated reports.

In the past some users have developed such templates.

The questions here are

Q1. What kind of template do you like to have?
Q2. Have you developed any template in the past? Would you mind to share it here? Don’t think it is useless, share it with community!

The Code Pattern

An end user can simple generate reports/make query as simple as below:

<$list filter="" template=""/>

or used filtered transclusion like

{{{ Filter || Template }}}

For example


<$list filter="[tag[HelloThere]]" template="tpl-links"/>


{{{ [tag[HelloThere]] || tpl-links }}}

generate a list of tiddlers title with link


<$list filter="[tag[HelloThere]]" template="tpl-fields"/>

generate a list of tiddlers with their fields


<$list filter="[tag[HelloThere]]" template="tpl-page"/>

generate a list of tiddlers with pagination (next | previous button)


<$list filter="[tag[HelloThere]]" template="tpl-draggable-link"/>

generate a draggable list of tiddlers (drag and drop to reorder…)


<$list filter="[tag[HelloThere]]" template="tpl-tableofcontents"/>

generate a custom table of contents with root tag HelloThere, …

How to pass extra variables? Use below format

<$let var1=... var2=...  var3=... >
<$list filter="[tag[HelloThere]]" template="tpl-amazing"/>

Where var1, var2, … are used inside tpl-amazing.

1 Like

Related topics:

Make any list a ToDo List

make a tiddler named List-ToDo and paste this code…

\define check-done() <$checkbox tag="done">&nbsp;Done!&ensp;</$checkbox>

\define uncheckActions() <$action-deletefield priority />
\define check-priority() <$checkbox field="priority" checked="high" unchecked="" uncheckactions=<<uncheckActions>> default="">&nbsp;priority&ensp;</$checkbox>

\define menu-status() <$select field=status default="status"><$list filter="[[not started]] [[in progress]] waiting [[on hold]]"><option value=<<currentTiddler>>><$view field="title" /></option></$list></$select>

\define btn-delete() <$button class="tc-btn-invisible" tooltip="delete tiddler" aria-label="delete"><$action-deletetiddler $tiddler=<<currentTiddler>> />{{$:/core/images/delete-button}}&nbsp;delete</$button>

<summary><$list filter="[<currentTiddler>tag[done]]">&#9989;&ensp;</$list><$list filter="[<currentTiddler>priority[high]]">&#127775;&nbsp;</$list><$link/></summary>&emsp;<<check-done>><<check-priority>>&nbsp;<<menu-status>>&nbsp;<<btn-delete>><blockquote><$transclude mode=block /></blockquote>

the result…


Amazing! Love it! Thank you for sharing Brian!

@Mohammad I have looked at this question of custom list item templates, and apart from Making the list item template more hackable I have considered if I could provide you with a set of ListItem template examples. Especially since I have employed many over the years. With this I have realised it is not so much what the different listItem templates are that I have used, but the elements I have used within the list items template.

For example;

In the template you can include any button such as
{{||$:/core/ui/Buttons/edit}} <$link/> or {{||$:/core/ui/Buttons/open-window}} <$link/> as long as currentTiddler is valid.

Or the classic caption or title link

<$link to=<<currentTiddler>> >
<$view field=caption>
  <$view field=title/>

Or rather than using the link widget use the button widget… and many more.

Here is one that displays the whole listed tiddler;

<$link to=<<currentTiddler>> >
<$view field=caption>
  <$view field=title/>
</$view></$link> {{||$:/core/ui/Buttons/edit}}&nbsp;</legend>
<$transclude mode=block/>

So now I am not sure the best way to proceed, what are you thoughts?

  • Do we build a collection of list elements, or named list item templates or none of these?

Thank you @TW_Tones
Very useful.

Yes, I will build a collection and share back to community!
I am looking for more input and I hope every user with an idea contribute here.

@Mohammad I am implementing a few list items templates now and keeping your request in mind. Just thought I would share my progress on this for inspiration;

  • I have enhanced the Projectify todo lists to include a list item toolbar, basically it includes buttons relevant to each todo tiddler in the list. To ease adoption I created a tag to assign to any tiddler, to include as a listitem toolbar element.
  • Thus I have concluded that perhaps a generic list item driven by a nominated specific tag, or tiddlers named in a list field, that includes different elements on the list item template, is the best way to go. So the thing that is customised in the individual elements in the list item.
    • So we can create a generic list template which we clone to a named template, and configure with the elements we want to display. We then use this named template as the template=mylisttemplate to use OR {{||mylisttemplate}} in the listwidgets body.
    • To make it even simpler a support macro eg
      <<list-with filter:"filter" template:"mylisttemplate">> could be given that provides even the list widget, or even just the list item elements tag;
      <<list-with filter:"filter" tag:"$:/tags/todo-itemlist">>
      • often this would be sufficient otherwise we use the template

With TiddlyWiki 5.3.0 we could create a custom widget

  • eg; <$$list-items filter=" filter " template="listitem template" | list-item-tag="$:/tags/todo-itemlist/> where “|” is an OR.
1 Like

See a simple template to create quiz

NOTE that

<$list filter="" template=""/>

is equivalent to filtered transclusion like

{{{ Filter || Template }}}