Tab Issue: content not showing

I have an issue with the content of tabs not showing up. A sanitized version of the demo I’m writing (to eventually autogenerate) is at http://scott.sauyet.com/demo/2023-01-10a/.

The tiddlers in question are rendered through a ViewTemplate and from my reading of the bottom of tabs Macro, I added a tiddler with this:

<$tiddler tiddler=<<currentTab>>>
<$transclude mode="block" />
</$tiddler>

and included it as the template attribute in the call to the tabs Macro

But it doesn’t work when the content is viewed through this ViewTemplate, which you can see by viewing the group Amazing/AU-R001. Note that the Items in the tabs at the bottom are empty, even though the two items show fine outside of tabs.

This definitely has something to do with how I’m doing tabs with the ViewTemplate, since this doesn’t happen in the case (Amazing/AU-R002) where I put that same ViewTemplate code directly in the tiddler.

Any suggestions for what I’m doing wrong?

(Note: although this version does not have quotes around the Tabs attribute, I’ve tried with them and it made no difference. I just forgot to put them back before I uploaded.)

The problem is because in $:/_myapp/templates/tab you are trying to display a tiddler whose content relies upon a view template, but you aren’t applying that template when you transclude the tiddler.

To fix this, change:

<$tiddler tiddler=<<currentTab>>>
<$transclude mode="block" />
</$tiddler>

to:

<$tiddler tiddler=<<currentTab>>>
<$transclude tiddler="$:/_myapp/templates/item" mode="block" />
</$tiddler>

Note that, although the parameter for the $transclude widget is named “tiddler”, it is actually specifying a “template” reference for displaying the contents of the <<currentTiddler>> (which in the above code has been set to the <<currentTab>> value by the surrounding $tiddler widget).

3 Likes

Thank you very much. This solved it.

A follow-up, if I may, where in the documentation should I have seen this?