it can be obtained from the transclusion variable:
mywidget.getTidName = function() {
var transclusion = this.getVariable("transclusion");
if (transclusion) {
return transclusion.split('|')[1];
}
else {
return "";
}
}
On Monday, March 4, 2019 at 1:37:56 AM UTC+1, stefano franchi wrote:
>
> I am sure this is stupid question whose answer is staring at me, but I
> can't find it:
>
> How do you access a tiddler from within a widget plugin's code?
>
> All I was able to find is that
> 1. All tiddlers are accessible by title from $tw.wiki
> 2. The title of a tiddle is stored in the widget's parent's
> transcludeTitle
>
> So, when I need the value of myField I end up with this expression in the
> plugin code:
>
> myFieldValue =
> $tw.wiki(this.parentWidget.transcludeTitle).fields["myField"]
>
> which looks to me as going from New York to Boston via Tokyo. Besides, I
> dislike using globals and would rather have the widget telling me the
> tiddler data it is working on.
>
> Surely there's a better way?
>
> Cheers,
>
> Stefano
>
> --
> __________________________________________________
> Stefano Franchi
>
> [email protected] <javascript:>
> http://stefano.cleinias.org
>
--
You received this message because you are subscribed to the Google Groups
"TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tiddlywikidev.
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywikidev/64cc13a0-1ce2-4f47-8d67-4352b65cad01%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.