Modals and $:/tags/ViewTemplate

Hi ,

when using modals , the specified tiddlers text field is what gets displayed, but the content that i am intersted to display is the outside view , as i am using another tiddler tagged $:/tags/ViewTemplate to hold the contents for the outside view of tiddlers

is there a way to use modals to display the outside view of a tiddler and not its text content

Inside the modal you can access variables passed to the modal or even transclude other fields and tiddlers. So within your mobile use your standard methods to display content from elsewhere and it should work. Keep in mind the current tiddler may change when displaying the modal.

Thanks tones,

ok i might have asked the wrong question , so what i am trying to achieve is have a list filter ,that lists some tiddlers, and next to every tiddler a button(modal in this case ) ,and that button when clicked it would display several fields for the listed tiddler

so what i have in tiddler A

<$button class=“tc-btn-invisible tc-tiddlylink”>
[img[img.png]]
<$action-sendmessage $message="tm-modal" $param=<<currentTiddler>> />

This modal displays the contents of tiddler A

but with a preceding filter like <$list filter=" [tag[anytag]]">
every listed tiddler will have a modal next to it which displays the contents of every tiddler respectivly , which is nice!

but it only displays the text field, what if i want to display more content for the listed tiddlers in the modal ?

i hope this makes sense

The modal tiddler needs to be prepared to act as a modal. Have a look at tm-modal and modals which describes the fields you use to customise the modal.

  • Typically we don’t use any old tiddler as a modal, but make a single one to display the content of more than one tiddler.
<$action-sendmessage $message="tm-modal" $param="ModalTiddler" showTiddler=<<currentTiddler>>/>
  • may be the action in the button(s)

Then inside the modal tiddler you may use;

<$transclude tiddler=<<showTiddler>>/>

or use $tiddler widget to set the tiddler/currentTiddler to <<showTiddler>> to access other fields.

  • But the modal tiddler will hold the fields in described in modals

If you need more, I can help tomorrow but these tips should get you there.

HI Again,

so i have followed the instructions , but it achieved the same effect, its the tiddler text that can be displayed , if i add something like a view field widget in the modal tiddler it displays the field value of the modal tiddler , and does not respect the filter


I read through modals and tm-modals , there is one example to make an input field that stores values in temp tiddlers , but i want to display field values for tiddlers listed under a filter ,

so when i put a modal underneath <$list filter=" [tag[anytag]]"> , not only would it display the text field but also other fields for the listed tiddler ( not the modal tiddler)

in the below screen shot you can see that i have a view widget in the modal tiddler, now if i go and click on the modal button , i don’t get the “sum” field value for tiddler A in the list filter, i get the field value in the modal tiddler

so i want to get the “sum” field value of tiddler A when i click on the modal button , how can i do that .

also i apologize if i am repeating the same question you have already answered, but i am still stuck and couldn’t really progress much :confused:

In your ModalTiddler the use of the view widget does not set the tiddler name so it will use the currentTiddler. I will try and package a modal, and a list that invokes it, as a demonstration because it can be difficult finding the words to describe the different tiddlers involved.

modal-sample.json (1.1 KB)

Notes:

  • The attached package installs two tiddlers “ModalTiddler” and “TestModal” (that calls ModalTiddler from a list).
  • As you have identified you need actionsendmessage to add parameters
  • The modal shows some values it gets then sets the current tiddler inside a “$tiddler” widget.
  • In this example we show a value in a field of the listedTiddler, in this case the tags field.

I hope this helps

1 Like

Thank you very much Tones :slight_smile:

Worked!

so basically declare a variable in the action widget as current tiddler , then in the modal tiddler you use the tiddler widget to change the current tiddler value to the variable declared in the action widget

ok one last question if possible , how does the variable in the action widget gets recognized in the modal tiddler?

I mean they are 2 different tiddlers , how does one variable carry over to the other tiddler , i thought you can only use a variable within the tiddler it is declalred inside?

In a way the modal tiddler is inside the tiddler that calls it, but the tm-modal message is what sets these variables for use within the modal.

1 Like