Need help to correctly transclude buttons into a viewtemplate cascade in table format

I am making a tiddler-multicolumn-views using viewtemplate cascade - columns are actually columns of a html table). It’s progressing well with some CSS and html help from AI (Phind)

In the above image you can see two columns. I can change the template for each column by changing the fields column-1 or column-2 of currentTiddler. For that I have added some buttons into the UI floating on either sides. Initially the buttons were like the ones on the right side (button code was directly added to the template code - see the template here. These buttons are working correctly.
Now I am trying to make each of those buttons into separate tiddlers (here is a sample button.) and dynamically transclude the buttons in a table format into the currentTiddler using viewtemplate cascade - code is seen in the top part of this template tiddler. As you can see from the image given above, those buttons are correctly appearing on the left side of the tiddler. But nothing is happening. But the buttons on the right side are working well. I must be incorrectly transcluding the buttons. I know that the code is messy. You have to look only at the top part of the template tiddler to see the button’s table code. Please can someone help.

Without looking at your code check that as you transclude the button use || to indicate to operate on the current tiddler eg; {{||$:/core/ui/Buttons/edit}}

I am not directly transcluding the buttons. I am listing and transcluding the buttons into a html table in the viewtemplate.There lies the issue. I am trying to sort it out. But not yet successful. Hope someone can help in case I fail

Looking at your template, I think it’s the same issue, the $list’s you use in the template change the currentTiddler (because none of them use variable=variable-name), for tiddler buttons to operate correctly they must know the tiddler on which to act.

  • Do work through it to see if the buttons are applied to the intended tiddler title, if any.

How to do that ? I don’t have much idea about variable part. Let me read about it

Let me try and follow;

  • We see the following tiddler Tweet-theliverdr/Fatty liver in two columns on a wide screen
    • The two columns displayed look like they are stored in the fields column-1 and column-2
    • I presume column-1 is the left hand one or $:/arsheth/tiddler-multicolumn-views/preview-template
      • This tiddler transcludes <$transclude mode="block" tiddler="$:/arsheth/viewtemplate/alternate-basic" />
        • This now transcludes this-tiddler using after setting this-tiddler to the “currentTiddler” I am not sure why you would not just use <$transclude/> and thus you could do this instead of using $:/arsheth/viewtemplate/alternate-basic at all.
        • But any way this makes sense we are in the right place, because we see the images as listed in the original tiddler.
          • I had to stop here, because I can see you would have a better chance of understanding this than I.

Having not being the designer I am finding it hard to follow, and especially hard to check when you include the buttons that they would apply to the correct tiddler.

If I were faced with this in my own work I would;

First do a hunt and peck around my code to see if I can determine if the button has the right context etc… I could set the button to display currentTiddler or use the tooltip, to display information the button knows about. This may help me find out why it is broken, eg wrong current tiddler.

Second I would work through the code and list the various tiddlers involved and their relationships such as “this transcludes that”. Perhaps draw a tree or pseudo code. I would then try and work back from the broken buttons to see if I can find what is going wrong.

Thirdly, If I am still getting confused and cant find the problem I would review my code and try and simplify it with “modules” using procedures and functions, commenting the code to divide it into different sections, so I know which chain of code/tiddlers to follow to resolve a problem occurringg in a particular place.

Sorry, currently it would demand too much of my time, but perhaps the above approach will help you.

Thank you @TW_Tones for taking time to look into this…you have almost correctly decoded the UI. Only problem I am facing now is with those buttons listed using a html table. I didn’t get time to look into it more. I haven’t used procedures and functions much , so I will have to read the docs about them. The current code you see for the button table is not correct, but this was the only code which I could come up with which shows the buttons in the UI, rest of my test codes failed to even show the buttons in the UI. I will continue the testing.

In this UI, there is option to change the number of columns from one to three using a viewtoolbar button ( which I copied from one of your previous implementation)

I am glad it helped but I have not used it much. Best of luck

1 Like