trigger a rerendering of a tiddler from a button.

215 views
Skip to first unread message

Matthew Lauber

unread,
Sep 3, 2015, 3:52:02 PM9/3/15
to TiddlyWiki
Hey All, I've got a unusual request.  I've created a list filter 'shuffle' that randomizes the order of a list.  Each time it's rendered the list changes.  Combining this with a 'first' I can get a random subset of the list (think choosing 10 random character names).  But unfortunately, I haven't been able to come up with a fully satisfactory way to refresh the list.  Ideally, I'd like to be able to click a button and repaint the tiddler, without it being treated as if the data changed (because it hasn't)  I've gotten a button working with the following code, but every time it's clicked, the tiddlywiki thinks it needs to be saved.  Can anyone think of a better way to handle things?

<$button>
<$action-sendmessage $message="tm-edit-tiddler" />
<$action-sendmessage $message="tm-cancel-tiddler" $param="Draft of 'Names'" />
Refresh
</$button>

Eric Shulman

unread,
Sep 3, 2015, 5:19:34 PM9/3/15
to TiddlyWiki
One way to force a refresh of some content is to make it dependent on a tiddler value by wrapping it inside a <$set>...</$set>, like this:
<$set name="trigger" value={{$:/temp/trigger}}>
   *** your content here ***
</$set>

Then, write a button that changes the $:/temp/trigger value, like this:
<$button>
<$action-setfield $tiddler="$:/temp/trigger" $value=<
<now "0hh:0mm:0ss">>/>
refresh trigger
</$button>

By setting the trigger text to the current time, the value of the trigger changes each time you press the button.  This, in turn, triggers the refresh of the dependent content.  Note that, by using $:/temp/... to store the trigger, it will avoid marking the document as "dirty" (in need of saving).

enjoy,
-e
Eric Shulman
ELS Design Studios
TiddlyTools - "Small Tools for Big Ideas!"
InsideTiddlyWiki: The Missing Manuals

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:

Matthew Lauber

unread,
Sep 3, 2015, 6:29:57 PM9/3/15
to TiddlyWiki
Brilliant!  Always learning something new.  Never heard about the $:/temp thing before.
Thanks,
Matt

History Buff

unread,
Apr 5, 2021, 5:26:46 PM4/5/21
to TiddlyWiki
So I have a situation where I thought the above would solve my problem, but I haven't been able to get there yet.

I have a Shiraz Dynamic Table where one of the columns contains footnotes using Mohammad's Refnotes plugin. I also have it set up so that I can filter the content of the dynamic table with a search parameter. So far so good. The footnotes are numbered 1 through "x" and when I enter a search parameter, the results of the results are filtered and the footnotes get renumbered 1 through  "y" as expected.

I also have the showfnotes macro below the dynamic table to list the footnotes. This works fine until I enter a search term and filter the table. Once filtered, the footnotes that are shown retain the pre-filter numbering unless I leave the tiddler and come back to it which then renumbers the footnotes being shown starting at 1 and now matches the filtered content. I can get similar behavior when I wrap the showfnotes macro in a details widget. If I close and then reopen the details widget, the footnotes shown get renumbered to match the filtered content. I would like to have the footnotes being listed by the showfnotes macro to automatically get renumbered when I filter the content of the above dynamic table. Wrapping the showfnotes macro in the set widget as mentioned above and setting the trigger to the current time using my search button doesn't do the trick. Any suggestions? Thanks in advance.

Mohammad

unread,
Apr 6, 2021, 4:53:28 AM4/6/21
to TiddlyWiki
Hi History Buff,
If I understand your question well,  it is only related to showfnotes.
You like showfnotes renumber the output based on the filtered list of tiddlers (footnotes??)

Would you please provide a minimum example wiki?

--Mohammad

History Buff

unread,
Apr 6, 2021, 12:16:24 PM4/6/21
to TiddlyWiki
Hi Mohammad,

Thanks for the reply. It will take me some time to generate a sample wiki. In the meantime, here are some screenshots that better illustrate what I'm talking about.

This first one is the initial dynamic table with no search performed to filter the results (just showing the column with footnotes because my content is proprietary):

DynamicTableUnfiltered.png

Now here is the result of showfnotes with the unfiltered footnotes:

showfnotes-unfiltered.png

Now I perform a search to filter the results of the dynamic table (just as you did as an example). The footnotes are renumbered to start at 1:

DynamicTableFiltered.png

Here is the results of the showfnotes after filtering the dynamic table results. I have not closed and re-opened the details widget yet. You can see that the footnotes start with number 6 which is the unfiltered numbering. The output of the showfnotes shows only the filtered results, but they are not numbered correctly:

showfnotes-filtered.png

Finally, if I simply close the details widget and re-open, the showfnotes output is renumbered:

showfnotes-filtered-details-reopened.png

I know that you're using a css counter. I've tried inserted a counter reset with a stylesheet in various places, but it has made no difference so far.

Damon

Mohammad Rahmani

unread,
Apr 7, 2021, 10:47:03 AM4/7/21
to tiddl...@googlegroups.com
Hi Damon,
 Yes, it seems something is wrong with the counter in this complex case! Unfortunately I could not reproduce the issue as the case is a complex one!
 I am working on Refnotes and I will have a look to clean up the stylesheets and see if everything is correct!


Best wishes
Mohammad


--
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 tiddlywiki+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/c2a154ab-3dec-42b5-9e07-a4224f9685d5n%40googlegroups.com.

History Buff

unread,
Apr 7, 2021, 1:02:45 PM4/7/21
to TiddlyWiki
Mohammad,

Thanks for checking into it. I'll play around with it some more as well to see if I can gather further information. Leave it to me to come up with a complex case like this!

Reply all
Reply to author
Forward
0 new messages