TW5 listWidget renders the tag rather than the results.

64 views
Skip to first unread message

myst...@gmail.com

unread,
Jun 7, 2017, 7:05:51 PM6/7/17
to TiddlyWiki
I have a table of text-edit fields. and a variable that determines the # of rows.
All data is stored in a data tiddler. on first view, some indexes won't exist yet, so i can't do any fancy [indexes] filtering.



  <$list filter="1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 +[addprefix[$field$]] +[first[<$transclude tiddler="$:/Data/$(currentTiddler)$" index="$field$"/>]]" variable="idx">
   <tr><td>
    <$edit-text  tiddler="$:/Data/$(currentTiddler)$" index=<<idx>> tag="input" />
    </td></tr>
  </$list>

What ends up rendering for me is:
(field == 'hind' which has a value of '6')
<$list filter="1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 +[addprefix[hind]] +[first[6]]" variable="idx">

but i clearly should not be seeing the tag, it should be getting rendered.

as a result, <<idx>> renders once and contains the json string contentds of the Data tiddler.


Is there a better way to do this? Am i missing something?

myst...@gmail.com

unread,
Jun 7, 2017, 8:35:56 PM6/7/17
to TiddlyWiki
In my expanding list of things that look like they should work, but fail:

<$list filter="1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 +[addprefix[$field$]] +[first[$:/Data/$(currentTiddler)$]getindex[$field$]]" variable="idx">

Mark S.

unread,
Jun 7, 2017, 11:33:41 PM6/7/17
to TiddlyWiki
Hello myst..

As you've discovered, you can't insert a widget into the middle of a filter. What you need to do is capture the index information you want outside the <$list>, possibly via a <$set> widget, and then use value inside of the <$list>. The following data and tiddler seems to work for me --

With data set $:/Data/testme :

hind: 3
hind1
: A
hind2
: B
hind3
: X
hind4
: D

and tiddler testme:

\define mymacro(field)
<$set name="rows" value={{$:/Data/$(currentTiddler)$##$field$}}>
 
<$list filter="1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 +[addprefix[$field$]] +[first<rows>]" variable="idx">
$
(currentTiddler)$  
<tr><td>
   
<$edit-text  tiddler="$:/Data/$(currentTiddler)$" index=<<idx>> tag="input" />
   
</td></tr>
 
<
/$list>
</
$set>
\end

<<mymacro "hind">>


Good luck,
Mark

myst...@gmail.com

unread,
Jun 7, 2017, 11:48:17 PM6/7/17
to TiddlyWiki
I had actually tried using <$set>  except i was using it as:
   +[first[<rows>]]

I'm such a noob still.  I need to look for a 'TiddlyWiki for Outright Noobs' book to explain filters and when [] is and is not required.

Thank you for help. It is most appreciated.

  -- Kenn

Mark S.

unread,
Jun 8, 2017, 12:08:17 AM6/8/17
to TiddlyWiki
Hi Kenn,

Macros, widgets, transclusion, indexes, 3 different types of variables, filter runs, textreferences ... it's all a very ad hoc system and not entirely consistent. It's not straight forward to learn ... or to explain. But the TW gurus can do near miracles with it. So just keep at it, look at other people's code, and eventually stuff will start to click. Hopefully.

HTH
Mark
Reply all
Reply to author
Forward
0 new messages