> I would like to be able create a sort of treeview diagram like the
> RelatedTiddlersPlugin does it
> (http://www.tiddlytools.com/#RelatedTiddlersPlugin), but based on
> costum fields instead of internal links.
>
> I cannot, however, get RelatedTiddlersPlugin to do it or find a plugin
> that does it for me.

RelatedTiddlersPlugin documentation describes how to use your own
'callback function' to create a tree display using data from any
tiddler field you want.  In order to define and invoke your callback,
you need to embed a small bit of script into a tiddler, using
    http://www.TiddlyTools.com/#InlineJavascriptPlugin
(which adds support for <script>...</script> handling embedded in TW
syntax)

First, you have to define a function that, given a tiddler object,
returns an array of tiddler titles that are 'related' to it.  For your
purposes, it appears that you are using two custom fields, "field" and
"field2", each containing the name of a single 'related' tiddler (or
possibly a blank/undefined value?).  Thus, your callback function
should simply construct and return an array of the two values in those
fields.

Then, to generate the output, you invoke the 'getTree(...)' function
provided by RelatedTiddlersPlugin.  This function takes three
arguments: the title of a tiddler to start from (the 'root' of the
tree), a space-separated list of tiddler to exclude from the tree (can
be blank, i.e, ""), and a reference to the custom callback function
that you've defined.

The getTree() function returns a text string, containing fully-
formatted wiki-syntax output for displaying the tree... which can be
rendered simply by returning it as the result of the inline script
itself.

Here's the basic script (untested):

<script>
window.myCallback=function(tiddler) {
        var list=[];
        if (tiddler.fields.field) list.push(tiddler.fields.field)
        if (tiddler.fields.field2) list.push(tiddler.fields.field2)
        return list;
}
var start="SomeTiddler";
var exclude="NotThisOne [[or this one with spaces]]";
var callback=window.myCallback;
return config.macros.relatedTiddlers.getTree(start,exclude,callback);
</script>

enjoy,
-e

--

You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/tiddlywiki?hl=en.


Reply via email to