On Friday, July 10, 2020 at 7:00:52 AM UTC-7, David wrote:
>
> I am looping over some tiddlers with the ListWidget.
> I was using the variable attribute, but have removed that to access 
> fields directly (via {{!!fieldname}} type calls, and for best practice 
> reasons, etc.
> But I need to know  how to refer to the parent tiddler's field (not the 
> child's) in a reveal's state attribute.
> This (the "!!edit_priorities" state, which refers to a field in the 
> parent tiddler) used to work when the filter was using the item variable, 
> but needs some tweaking now, because the "scope" it's in has changed to the 
> child tiddler (I assume).
> <$list filter="[tag[Task]!tag[Done]]" >
> <$reveal type="match" state="!!edit_priorities" text="1">
> <$edit-text field="priority" size="3" />
> </$reveal>
> <nobr> <$checkbox tag="Done"/> <$link>{{!!title}}</$link></nobr>
> <br/>
> </$list>
> So, in words, what I'm trying to do is list todo tasks that are not tagged 
> as done.  In that tiddler as well is a field, which I use to control the 
> display of the Priority edit boxes.  If I set that field to '1', then I 
> want the reveals to show the edit boxes for each task.
>

To do what you want, you'll *need* to use variable="..." in the $list 
widget.
This will allow you to keep the "parent" tiddler context as the 
currentTiddler.

Of course, you have references *inside* the $list loop that you would like
to keep simple by having the $list use currentTiddler, but that would defeat
what you want to do with the "priority" field.

One way to achieve a mix of both, is to explicitly use the tiddler="..." 
widget
parameter or wrap content in a $tiddler widget to set the inner context.

Something like this:
<$list filter="[tag[Task]!tag[Done]]" variable="item">
   <$reveal type="match" state="!!edit_priorities" text="1">
      <$edit-text tiddler=<<item>> field="priority" size="3" />
   </$reveal>
   <$tiddler tiddler=<<item>>>
      <nobr> <$checkbox tag="Done" /> <$link /></nobr><br/>
   </$tiddler>
</$list>

notes:
* the $edit-text uses an explicit tiddler=<<item>> param to point at the 
individual task tiddler
* the $checkbox and $link are surrounded by a $tiddler widget that sets the 
<<currentTiddler>> to the <<item>> value
* I've used the "short form" of <$link />, since you are just linking to 
the <<currentTiddler>>

enjoy,
-e

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/fa0586b4-ae2a-41e7-ad4c-18c41ebcc645o%40googlegroups.com.

Reply via email to