[TW5] refresh a tiddler

275 views
Skip to first unread message

FFT

unread,
Oct 24, 2016, 2:15:41 PM10/24/16
to TiddlyWiki
I have a tiddler that I'd like to refresh. I can accomplish this by reloading the entire document, but I'd prefer clicking on a button or link within a specific tiddler and have it refresh. Is there a way to do this?

Mark S.

unread,
Oct 24, 2016, 2:40:09 PM10/24/16
to TiddlyWiki
I think you need to explain a little more what you want or what you are trying to do. The tiddlers pretty much always refresh. Maybe give an example of what you expect to see.

Good luck!
Mark

FFT

unread,
Oct 24, 2016, 2:50:32 PM10/24/16
to tiddl...@googlegroups.com
I have this in a tiddler: [img[http://ichart.finance.yahoo.com/t?s=^DJI]]

This image changes throughout the day. I would like to keep this tiddler open and click a "refresh tiddler" button to have the new image served.

Jed Carty

unread,
Oct 24, 2016, 3:02:54 PM10/24/16
to TiddlyWiki
Try putting a set widget around the parts that you want refreshed. Something like this:

<$set name=dummy value={{$:/temp/update}}>
[img[
http://ichart.finance.yahoo.com/t?s=^DJI]]
<$button>Refresh Tiddler
<$action-setfield $tiddler='$:/temp/update' text=update/>
</$set>

the set widget gets updated when you click the button and everything inside it should be refreshed. The value and tiddler used don't matter at all, just that it changes.

Tobias Beer

unread,
Oct 24, 2016, 3:38:26 PM10/24/16
to tiddl...@googlegroups.com
Hi Jed,
 
Try putting a set widget around the parts that you want refreshed.

I believe you may actually need to change the text:

<$set name=dummy value={{$:/temp/update}}>
[img[http://ichart.finance.yahoo.com/t?s=^DJI]]
<$button>Refresh Tiddler
<$action-setfield $tiddler='$:/temp/update' text=<<now>>/>
</$button>
</$set>

Best wishes,

Tobias.

FFT

unread,
Oct 24, 2016, 5:22:49 PM10/24/16
to TiddlyWiki
Thanks for suggesting this, however I am not able to get this to refresh after clicking the button. Is there something else I can try?

On Monday, October 24, 2016 at 12:38:26 PM UTC-7, Tobias Beer wrote:
Hi Jet,
 
Try putting a set widget around the parts that you want refreshed.

I believe you may actually need to change the text:

<$set name=dummy value={{$:/temp/update}}>
[img[http://ichart.finance.yahoo.com/t?s=^DJI]]
<$button>Refresh Tiddler
<$action-setfield $tiddler='$:/temp/update' text=<
<now>
>/>
</$set>

Best wishes,

Tobias.

Mark S.

unread,
Oct 24, 2016, 5:45:26 PM10/24/16
to TiddlyWiki
There needs to be a closing </$button> tag just before </$set> in Tobias' version.

However, I can't tell if it works -- all the stock markets are closed! The Hong Kong Market won't open for another 4 hours. The London for another 11. 16 for the Dow.

Good luck!
Mark

FFT

unread,
Oct 25, 2016, 1:59:49 PM10/25/16
to TiddlyWiki
I added the </$button> tag, however the tiddler did not rerender the image upon clicking the refresh button; I tried clicking it after 30 minutes and it still didn't work.

BJ

unread,
Oct 25, 2016, 3:02:52 PM10/25/16
to TiddlyWiki
the image is probably being cached by the browser try

\define img(x)
[img[http://ichart.finance.yahoo.com/t?s=^DJI#?$x$]]
\end


<$set name=dummy value={{$:/temp/update}}>
<$macrocall $name=img x=<<now>>/>

<$button>Refresh Tiddler
<$action-setfield $tiddler='$:/temp/update' text=<<now>
>/>
</$set>

Mark S.

unread,
Oct 25, 2016, 3:22:28 PM10/25/16
to TiddlyWiki
That seems to work on my system. It doesn't seem to need the <$set> tag. It should probably have the closing button tag for completeness.

FFT

unread,
Oct 25, 2016, 3:55:29 PM10/25/16
to tiddl...@googlegroups.com
Regarding the <$set> tag, can you help clarify what I can remove? This is what I have using BJ's suggestion.


\define img(x)
[img[http://ichart.finance.yahoo.com/t?s=^DJI#?$x$]]
\end

<$set name=dummy value={{$:/temp/update}}>
<$macrocall $name=img x=<<now>>/>

<$button>Refresh Tiddler
<$action-setfield $tiddler='$:/temp/update' text=<<now>>/>
</$button>
</$set>

Mark S.

unread,
Oct 25, 2016, 4:02:39 PM10/25/16
to TiddlyWiki
This version is working on my system:

define img(x)
[img[http://ichart.finance.yahoo.com/t?s=^DJI#?$x$]]
\end

<$macrocall $name=img x=<<now>>/>
<$button>Refresh Tiddler
<$action-setfield $tiddler='$:/
temp/update' text=<<now>
>/></$button>

Good luck!
Mark

Mark S.

unread,
Oct 25, 2016, 4:07:00 PM10/25/16
to TiddlyWiki
Just looked at the time. Once again, I think all the markets are closed. Need a different changeable image source to test on.

FFT

unread,
Oct 25, 2016, 4:12:46 PM10/25/16
to tiddl...@googlegroups.com
Thanks Mark and others; it's working for me now.

Tobias Beer

unread,
Oct 26, 2016, 12:54:39 AM10/26/16
to TiddlyWiki
Hi Mark,

The following quite likely works just as well:
 
\define img(now) [img[http://ichart.finance.yahoo.com/t?s=^DJI#?$now$]]

<$macrocall $name=img now=<<now>>/>

The reason is that with every friggin' change event in the wiki, like switching a tab in the sidebar, opening a tiddler, etc... and this tiddler being displayed, you change the attribute now which rerenders the macrocall widget which in turns goes to the server and asks for a new image.

In other words, this should be discouraged, unless your intention actually is to ask that server for a new graph with every click you make.

Best wishes,

Tobias.

Jed Carty

unread,
Oct 26, 2016, 4:09:20 AM10/26/16
to TiddlyWiki
You should probably keep the set widget, it is generally considered impolite to spam a server with unneeded requests like that.

This should get around the caching problem and not spam the server with requests:

\define img(x)
[img[http://ichart.finance.yahoo.com/t?s=^DJI#?$x$]]
\end

<$set name=CurrentTime value={{$:/temp/update}}>
<$macrocall $name=img x=<<CurrentTime>>/>

<$button>Refresh Tiddler
<$action-setfield $tiddler='$:/
temp/update' text=<<now>>/>
</$button>
</$set>

That should work without spamming the server. The button will only update the image if at least a minute has passed since the last update. It doesn't happen automatically, but it won't update unless at least a minute has passed. This is because the now macro without arguments returns a string that is only accurate to the minute. This is probably desirable here.
You can change
<<now>>

to something like
<<now ss>>

if you want to be able to update every second instead.

Jed Carty

unread,
Oct 26, 2016, 4:18:14 AM10/26/16
to TiddlyWiki
Sometimes you may have to click the button twice to make an update happen. I think that is some problem with the refresh mechanism and using the set widget. If you change the set widget to a list widget that may not happen, but I doubt that is a big concern.
Message has been deleted

FFT

unread,
Jul 9, 2019, 6:04:38 PM7/9/19
to TiddlyWiki
Although it only works in Firefox. Can it work in Chrome?

FFT

unread,
Mar 4, 2024, 3:24:16 PMMar 4
to TiddlyWiki
Refresh works for me in Firefox but not in Chrome. Why?
Reply all
Reply to author
Forward
0 new messages