views:

284

answers:

2

I've written up a weekly-review GTD checklist for myself in TiddlyWiki, using CheckboxPlugin. After I'm finished with it each week, I'd like to click one link to uncheck (reset) all of the items on it, so it's ready for the next use.

I'm storing the check information as tags on a separate tiddler page. I should be able to just erase all the tags on that page and refresh the checklist page, but I haven't been able to work out how to do that yet.

I generally work in C, C++, and Lisp, I'm just learning about Javascript. Can anyone offer some useful pointers?

(And before anyone suggests it, I've looked at the ChecklistScript on the same site. It doesn't use the CheckboxPlugin stuff, and isn't compatible with it.)

+1  A: 

Try this (adapted from ChecklistScript's "resetall" code):

<html><form style="display:inline">
    <input type="button" value="clear all" onclick="
     var tid='SomeTiddler';
     var list='tag1 [[tag 2]] tag3 tag4';
     var tags=list.readBracketedList();
     store.suspendNotifications();
     for (var t=0; t<tags.length; t++)
      store.setTiddlerTag(tid,false,tags[t]);
     store.resumeNotifications();
     story.refreshTiddler(tid,null,true);
"></form></html>
A: 

It took a while, but I figured it out (thanks to ELS's answer for the inspiration):

<script label="(Reset All)" title="Reset all items" key="X">
        var tid='WeeklyReviewStepsChecklistItems';
        store.getTiddler(tid).tags=[];
        story.refreshTiddler(tid,null,true);

        story.refreshTiddler('Weekly Review Steps',null,true);
</script>

This only works because I'm storing the tags in a separate tiddler, and using the InlineJavascriptPlugin.

Head Geek