How to transclude data tiddler entries as options

閲覧: 59 回
最初の未読メッセージにスキップ

Tristan Kohl

未読、
2018/07/20 12:51:182018/07/20
To: TiddlyWiki
Hey guys,

I have a little problem with my transclusions creating uniform rating values.

What I want is for Tiddler B to create an option widget for every entry in Tiddler A (see below):

Tiddler A:
title: $:/plugins/beehive/rating
caption: Rating
type: application/x-tiddler-dictionary

1: Poor
2: Moderate
3: OK
4: Good
5: Very good

Tiddler B:
Brood pattern: <$select tiddler=<<tempTiddler>> field="pattern">
        // how do I get options for all values in Tiddler A?
    </$select>

Hope, someone can help me out here, I have no clue how to do this :(

Cheers,
Tristan

Jed Carty

未読、
2018/07/20 12:59:112018/07/20
To: TiddlyWiki
This should work

<$select tiddler=<<tempTiddler>> field="pattern">
<$list filter='[[$:/plugins/beehive/rating]indexes[]]'>
<$list filter='[[$:/plugins/beehive/rating]getindex
<currentTiddler>]'>
<option><<currentTiddler>></option>
</$list>
</$list>
</$select>




Tristan Kohl

未読、
2018/07/20 13:22:492018/07/20
To: TiddlyWiki
Wow, that is impressive, thank you O.o

However I do not quite understand why we need the second list widget. Would you mind explain to me what it does? As far as I understand the first "currentTiddler" references my ratings tiddler since it gets assigned by the first list widget. But what does the second list do? And why do I have to pass my ratings tiddler to getindex?

Cheers,
Tristan

Tristan Kohl

未読、
2018/07/20 13:25:472018/07/20
To: TiddlyWiki
Oh and I saw that it passes "Good" etc. as the new value for my tempTiddler. I need it to assign the index value to that. So when I select "Good" it should assign "4" to tempTiddler. Sorry for not making that clear before.


On Friday, July 20, 2018 at 6:59:11 PM UTC+2, Jed Carty wrote:

Jed Carty

未読、
2018/07/20 13:30:442018/07/20
To: TiddlyWiki
The first list gets a list of the indexes (the labels 1, 2, etc.), the second list gets the value of each index. You could also do it with a set widget and get the same result. Or a view widget like this:

<$select tiddler=<<tempTiddler>> field="pattern">
<$list filter='[[$:/plugins/beehive/rating]indexes[]]' variable=IndexValue>
<option value=<
<indexValue>>><$view tiddler='$:/plugins/beehive/rating' index=<<IndexValue>>/></option>
</$list>
</$select>



setting the value attribute of the option sets the value stored if you want it to be different than the value displayed

Tristan Kohl

未読、
2018/07/20 13:37:192018/07/20
To: TiddlyWiki
Ah, I did not know that currentTiddler is the actual field. Thank you so much for explaining, it is sometimes a little tough wrapping my head around this being used to generic programming languages.
全員に返信
投稿者に返信
転送
新着メール 0 件