List-before and list-after mechanism

Folks,

Can anyone explain how the “list-before and list-after mechanism” works?. I understand how to use them, what I am not sure of is how this happens. I am moving the viewTemplate functionality into a custom one and want to know how I may replicate it in a list, rather than a tag.

list-after and list-before are respected by tag-filters eg: <<list-links "[tag[x]]">>

  • Let’s say tiddlers a, b and c are tagged x
  • All of them are shadow tiddlers
  • tiddler x has a list field with the value: a b c

If you create a tiddler eg:

  • test and tag it x,
  • add a field list-after: b

The <<list-links "[tag[x]]">> will show the test tiddler after b in the list.


Now show the list with <<list-links-draggable "x">>

The test tiddler is gone, because list-links-draggable directly accesses the list-field of tiddler x.


  • Now use <<tag x>>
  • Open the dropdown
  • tiddler test will be there
  • drag & drop sort the list

Now strange things happen:

  • list-links-draggable will also show test
  • tiddler x is converted to a normal tiddler and the list-field is adjusted
  • the list-after field from tiddler test is gone !!!

See the attached json and play with it.

test-list-after.json (880 Bytes)

1 Like

Mario,

Thanks for that. It then is clear that list after and before are used to place a tiddler title in an existing list and then are removed. This explains it well thank you.

Now as you said “drag and drop” in the tag tiddler triggers the creation of the list field. It would be nice if an action were available to do this in another trigger.

When using list-before and list-after on tiddlers to be added to the list of $:/tags/ViewTemplate the list- fields do not get removed.

So still a little more to learn but thanks for your insight.

It’s a possibility to add elements to list-fields, without modifying the tag-tiddler, if the tag tiddler is a shadow tiddler. …

As long as you don’t manually use the tag-dropdown to sort the list in the tag tiddler. If you do a manual sort, the shadow-tag will be cloned into a “real” tiddler and the list will be modified.

If the list is manually edited with the tag-dropdown the list-before and list-after fields are removed from the tiddler that contains them. … BUT If you use <<list-links-draggable "shadow-tag">> the list-xx field won’t be removed.

So <<list-links and <<list-links-draggable will show different lists. … That’s a bit confusing …