HowTo? <$appear> inside filtered list >state

Hej,

going on with my workout-Wiki :slight_smile: , now at the point of planning workouts.

So, among a lot of other tiddlers I have tiddlers for muscles, f.e. “Abs”.
And tiddlers for exercises, f.e. “Crunch”, tagged with muscles (f.e. exercise “Crunch” tagged with “Abs”).

Now I want to list some of them in a filtered list.
And then to be able to show /hide the listed exercises and show /hide several fields of these exercises.
For that, I integrated <$appear>into the filtered list.
It is working, but…
As feared, when “opening” one appear, then all of them “open”. And of course, it doesn’t matter, if I write anything as state-tiddler, because then, they all share the same state-tiddler and still “open” & “close” altogether.

This is the list:

<$list filter="[tag[Muskeln]suffix[primär]!muskelprio[3]tag[Unterkörper]sort[erholung]]" variable="frischeMuskeln">
    <<frischeMuskeln>>
<$appear state="$:/temp/state-planung-muskelbild" ><$transclude $tiddler=<<frischeMuskeln>> $field="muskelbild-klein"/></$appear>
    <ul>
        <$list filter="[<frischeMuskeln>tagging[]limit[1]]">
            <li><$link to={{!!title}}><$view field="title"/></$link><$appear state="$:/temp/state-planung-übung" ><$transclude $tiddler=<<frischeMuskeln>> $field="muskelbild-klein"/></$appear></li>
        </$list>
    </ul>
</$list>

Is it (hopefully) possible, to let them “open” & “close” individually?
Maybe with a variable for the state-tiddler?
If yes, how could I implement that?

Do you need some example-tiddlers in a test-wiki for helping?
I ask before, because it’s quite a bit work, to edit /simplify such example-tiddlers… :see_no_evil_monkey:

Thank you @all helping people :+1:

Yes, you can use a variable to set the state tiddler titles. The trick is to incorporate the current $list variable value into that title, so that each state title will be different.

Try this (note: untested code)

<$list filter="[tag[Muskeln]suffix[primär]!muskelprio[3]tag[Unterkörper]sort[erholung]]" variable="frischeMuskeln">
    <<frischeMuskeln>>
<$appear state={{{ [[$:/temp/state-planung-muskelbild/]addsuffix<frischeMuskeln>] }}}>
   <$transclude $tiddler=<<frischeMuskeln>> $field="muskelbild-klein"/>
</$appear>
    <ul>
        <$list filter="[<frischeMuskeln>tagging[]limit[1]]">
            <li>
               <$link/>
               <$appear state={{{ [[$:/temp/state-planung-übung/]addsuffix{!!title}] }}}>
                  <$transclude $tiddler=<<frischeMuskeln>> $field="muskelbild-klein"/>
               </$appear>
            </li>
        </$list>
    </ul>
</$list>

Notes:

  • Both $appear widgets use “filtered transclusions” to construct their state=... parameters based on the current $list widget’s variable value
  • The first $appear widget’s state appends “/” followed by the value of the frischeMuskeln variable
  • The second $appear widget’s state appends “/” followed by the current tiddler’s title
  • Also note the “short form” of the <$link/> widget. By default it uses the value of <<currentTiddler>> for the to=... destination as well as the link display text

-e

Ah yes, it’s working perfectly and I understand the code >and this is the best of it :+1: :+1:
Thank you for your really very good explaining always!! Your explaining is in clear form, short but friendly sentences, simple understandable words, reduced to the most important. In this way, I can understand better little by little.
THANK YOU!!

So now, what is the best for this topic?
Maybe, I will have some more questions later on (maybe even in some days) related to this list. Should I then open a new topic and mark this one now as resolved?
Or should I leave this one open until I do not have anymore questions to it? And without an additional topic?
Or should I mark this one as resolved and if I have later on more questions related to this list, then open this topic again as unresolved?