Trying to implement behaviour similar to the default tag list to create one-to-many relationships in one of my plugins. It seems as though the actions of the tag-pill do not get triggered whereas those of the button do. What am I missing?
This dumbed down version was exported from tiddlywiki.com.
result: a
test: a b c d
title: TestTiddler
<<tag-picker
tagListFilter:"[<currentTiddler>get[test]enlist-input[]] -[<currentTiddler>get[result]enlist-input[]]"
tagField:"result"
>>
!! Klicking the pill does not work
<$list filter="[<currentTiddler>get[result]enlist-input[]]" variable="tagname">
<$transclude
$variable="tag-pill"
tag=<<tagname>>
actions="""<$action-listops $field="result" $subfilter="-[<tagname>]" />"""
/>
</$list>
!! Klicking the button work
<$vars tagname="a">
<$button actions="""<$action-listops $field="result" $subfilter="-[<tagname>]" />"""
>
Klick
</$button>
</$vars>
Also any tips how to improve this use-case are very much appreciated.
Unlike the $button widget, the $transclude widget does not have an actions=... parameter to process click events. To handle clicks within transcluded content, you can surround the $transclude widget with an $eventcatcher widget, like this:
Note that if the transcluded content includes widgets that process clicks (e.g., $button widgets), then those widgets will handle the click events first and the surrounding $eventcatcher will never see those events.
Reading the documentation for the transclude widget I was under the assumption that the “actions” parameter (without a $ sign) would be passed down to the transcluded content. Since it works for the tag parameter, this - at least for me - is unexpected behaviour.
{attributes not starting with $} – Any other attributes that do not start with a dollar are used as parameters to the transclusion