2013-10-31 22:03:40 +00:00
created: 201310241419
2015-01-06 20:18:28 +00:00
modified: 20150106180000000
2014-09-10 23:06:19 +00:00
tags: Widgets
2013-08-13 18:33:45 +00:00
title: ListWidget
2014-09-10 23:06:19 +00:00
caption: list
2013-08-13 18:33:45 +00:00
2013-08-18 19:42:17 +00:00
! Introduction
2015-01-06 20:18:28 +00:00
The list widget displays a sequence of tiddlers matching a [[filter|Filters]]. It is vital for a various use-cases, e.g.:
2013-08-19 10:08:00 +00:00
2015-01-06 20:18:28 +00:00
* Displaying custom lists, e.g. "all tiddlers tagged ''task'' not tagged ''done''"
* Listing the tags of a tiddler
* Displaying lists of links, like in the sidebar
2013-08-18 19:42:17 +00:00
* Handling the main story river
2015-01-06 20:18:28 +00:00
! Examples
''plain list''
```
<$list filter="[tag[ListWidget]sort[title]]"/>
```
Displays as:
<<<
<$list filter="[tag[ListWidget]sort[title]]"/>
<<<
''custom item output''
```
<$list filter="[tag[ListWidget]sort[title]]">
<<currentTiddler>>
{{||$:/core/ui/ViewTemplate/tags}}
</$list>
```
Displays as:
<<<
<$list filter="[tag[ListWidget]sort[title]]">
<<currentTiddler>>
{{||$:/core/ui/ViewTemplate/tags}}
</$list>
<<<
''custom item template''
```
<$list filter="[tag[ListWidget]sort[title]]" template="$:/core/ui/ViewTemplate/subtitle"/>
```
Displays as:
<<<
<$list filter="[tag[ListWidget]sort[title]]" template="$:/core/ui/ViewTemplate/subtitle"/>
<<<
!! Grouped Lists
2015-01-11 10:55:22 +00:00
See GroupedLists for how to generate nested and grouped lists using the ListWidget.
2013-08-18 19:42:17 +00:00
! Content and Attributes
2015-01-06 20:18:28 +00:00
A number of options controll the list behaviour....
2013-08-18 19:42:17 +00:00
|!Attribute |!Description |
2014-10-10 20:06:48 +00:00
|filter |The [[tiddler filter|Filters]] to display |
2015-01-06 20:18:28 +00:00
|template |The title of a template tiddler for transcluding each tiddler in the list. When no template is specified, the body of the ListWidget serves as the item template. With no body, a simple link to the tiddler is returned. |
|editTemplate |An alternative template to use for [[DraftTiddlers|DraftMechanism]] in edit mode |
|variable |The name for a [[variable|Variables]] in which the title of each listed tiddler is stored. Defaults to ''currentTiddler'' |
|iterator|a custom iterator prefix, see IteratorVariables|
2013-08-18 19:42:17 +00:00
|emptyMessage |Message to be displayed when the list is empty |
2013-11-05 08:52:46 +00:00
|storyview |Optional name of module responsible for animating/processing the list |
2013-08-18 19:42:17 +00:00
|history |The title of the tiddler containing the navigation history |
2013-10-31 22:03:40 +00:00
2015-01-06 20:18:28 +00:00
!! Edit mode
2013-08-18 19:42:17 +00:00
2015-01-06 20:18:28 +00:00
The `<$list>` widget can optionally render draft tiddlers through a different template to handle editing, see DraftMechanism.
2013-08-20 14:18:15 +00:00
2013-11-05 08:52:46 +00:00
!! `storyview` attribute
2013-08-18 19:42:17 +00:00
2014-04-13 08:23:57 +00:00
The `storyview` attribute specifies the name of an optional module that can animate changes to the list (including navigation). The core ships with the following storyview modules:
2013-08-20 14:18:15 +00:00
* `classic`: renders the list as an ordered sequence of tiddlers
* `zoomin`: just renders the current tiddler from the list, with a zoom animation for navigating between tiddlers
2013-11-05 08:52:46 +00:00
* `pop`: shrinks items in and out of place
2013-08-20 14:18:15 +00:00
2014-09-27 09:34:59 +00:00
In order for the storyviews to animate correctly each entry in the list should be a single block mode DOM element.
2015-01-06 20:18:28 +00:00
!! History and navigation
2013-08-20 14:18:15 +00:00
2015-01-06 20:18:28 +00:00
The optional `history` attribute specifies the name of a tiddler that is used to track the current tiddler for navigation purposes. When the history tiddler changes the list view responds by telling the listview to handle navigating to the new tiddler. See HistoryMechanism for details.