[TWC] place <<tiddler AutoRefresh>> in other place than viewer

39 views
Skip to first unread message

julien bouchez

unread,
Jun 13, 2014, 5:28:28 PM6/13/14
to tiddl...@googlegroups.com
Hi All

I have several twTypes :

Constants
Company
Parts

I have added a new taggedTypes class in the ViewTemplate :

<div class='title' macro='view title'></div>
<div class='toolbar'  macro='toolbar [[ToolbarCommands::ViewToolbar]]'></div>
<div class='newTypeHere' macro='tiddler FetNewHere with:{{tiddler.title}}'></div>
<div class='thumbnails' macro='tiddler "FetThumbnails" thumbnails with:{{tiddler.title}}'></div>
<div class='viewer' macro='view text wikified'></div>
<div class='taggedTypes' macro='tiddler FetTypes with:{{tiddler.title}}'></div>
<div class='tagClear'></div>

[[FetTypes]]

<<forEachTiddler
    where
        'tiddler.tags.contains("twTypes")'
   write
 '"<<tiddler Fet"+tiddler.title+" with:[[$1]] [[$1]]\>\>"'"'
>>

How to have this class AutoRefresh like viewer does when I place <<tiddler AutoRefresh>> inside ?

Regards

Julien

Eric Shulman

unread,
Jun 13, 2014, 11:49:24 PM6/13/14
to tiddl...@googlegroups.com
On Friday, June 13, 2014 2:28:28 PM UTC-7, julien bouchez wrote:
I have added a new taggedTypes class in the ViewTemplate :
<div class='taggedTypes' macro='tiddler FetTypes with:{{tiddler.title}}'></div>
How to have this class AutoRefresh like viewer does when I place <<tiddler AutoRefresh>> inside ?

I assume you are referring to TiddlyTools' AutoRefresh "transclusion" script

The TWCore automatically adds certain special TWCore attributes (refresh="content" and tiddler="FetTypes") to the element that holds your transcluded content (i.e., a span contained within the 'taggedTypes' DIV).  When the TWCore's refresh handler is triggered by a change to tiddler content, it uses these attributes to determine which elements will be re-rendered.

By default, the transcluded element should automatically refresh whenever [[FetTypes]] is modified.  However, I don't think this is quite what you need, as the FetTypes tiddler content itself is unlikely to change very often, but the *output* from that tiddler can vary, based on other tiddlers that have changed.

Fortunately, there is a way to force the refresh of an element when *ANY* tiddler is changed, rather than just the tiddler that was transcluded.  To do this, you need to add refresh="content" and force="true" to the *containing* element in which the transcluded FetTypes tiddler is rendered, like this:

<div class='taggedTypes' refresh='content' force='true' macro='tiddler FetTypes with:{{tiddler.title}}'></div>

Let me know how it goes...
enjoy,
-e
Eric Shulman
TiddlyTools / ELS Design Studios

YOUR DONATIONS ARE VERY IMPORTANT!
HELP ME TO HELP YOU - MAKE A CONTRIBUTION TO MY "TIP JAR"...

Professional TiddlyWiki Consulting Services...
Analysis, Design, and Custom Solutions:
 

julien bouchez

unread,
Jun 14, 2014, 3:01:28 AM6/14/14
to tiddl...@googlegroups.com
Hi Eric

Thank you for the answer.

I get a weird behaviors
  • taggedTypes kind of refresh, but indeed it desapears. I need to edit/close the "host tiddler" to have it back displayed.
  • When I add a "Constant" to [[testTiddler]] it does not appear right away in its taggedTypes class

It is a 2 floors transclusion, maybe the autoRefresh should be one more level down to [[FetConstants]] ?...

I attached my tw to the post. You can watch that @ [[testTiddler]]

Regards

Julien

index.html
Reply all
Reply to author
Forward
0 new messages