Okay, as promised... here's the update.

I have a script that checks a tiddler for an old tag and swaps it out for a 
new one, like so:
*
*// Swap tags*
tiddler.tags.remove(senderTag);
tiddler.tags.pushUnique(receiverTag);*

The trouble is, these changes don't stick once I refresh the page.  The 
solution came from some code I borrowed from Tim Barnes' TiddlyKanban 
plugin—Thanks Tim!!! :)

// Save changes
*tiddler.incChangeCount();
tiddler.saveToDiv();
store.setDirty(title, true);

if (config.options.chkAutoSave == true) {
    saveChanges();
}*

I couldn't find the *incChangeCount()* method in the documentation on (so 
I'm not exactly sure what it does).

*tiddler.saveToDiv();* prepares the tiddler for saving,
*store.setDirty(title, true);* tells TW that a tiddler named *title* has 
changed and needs to be saved,

and the last three lines say that TW should save the changes now, only if 
the user has enabled autosave.  Otherwise, changes will be saved later when 
the user presses the "Save" link.

By-the-way, Tobias, tiddlywikidev has the *setDirty()* method as a call to 
"story".  But it looks like this should be on "store"?

On Tuesday, March 5, 2013 3:07:53 AM UTC-8, Tobias Beer wrote:
>
> Hi Adam,
>
> If you find the time, please share (a quick summary of) the details of how 
> you solved your problem; others (including myself) may be looking for just 
> the same [1].
>
> ;-)
>
> By the way, TiddlyKanban [2] has also implemented a method for refreshing 
> contents, see the *tiddler_changed* function...
>
> Cheers, Tobias.
>
>
> [1] https://groups.google.com/d/msg/tiddlywikidev/Pgbis-94ajg/CWHFLCKqR1gJ
> [2] https://github.com/tim-barnes/TiddlyKanban/blob/master/Kanban.js#L530
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to