Populate Select drop-down from folder structure

133 views
Skip to first unread message

MagoArcade

unread,
Aug 11, 2019, 3:50:04 PM8/11/19
to TiddlyWiki
OK - so here's a tricky one. How can I populate a select field in a tiddler from the folder structure available in TiddlyWiki>More>Explorer? I have this structure, which is dynamic:

tiddlymapviews.png


I want to grab everything under "views/" with no duplication and make it selectable via a drop down. So in this instacne, the dropdown would consist of:


Default

Graph Search

Live View

MyView


As a bonus for 50 points, I'd also ideally like to remove "Graph Search" and "Live View" from the options.


Any ideas?


Steve



Mat

unread,
Aug 11, 2019, 3:59:57 PM8/11/19
to TiddlyWiki
The method would be to identify what is common for those tiddlers, presumably by opening one and looking at their common tag and then making a filter. Something like

"[tag[thecommontag]] -[[Graphsearch]] -[[Live View]]" (make sure those last two are actually titled so, so it is not only their captions)


You put this in - as almost always - the ListWidget. 

<$list filter="the above">

</$list>

Ths is used to generat the list of "options" for the selectwidget, so you put this insdie the selectwiget. Here is the general idea:


<$select>
<$list filter="the above">
<option>
</$list>
</$select>


You'll have to work out the details.

<:-)

MagoArcade

unread,
Aug 11, 2019, 6:42:18 PM8/11/19
to TiddlyWiki
Thanks Mat - I see your thinking. However, these tiddlers don't have any tags and it's from a 3rd party plugin, so I can't influence that. They do, however, have a unique field: "isview: true" - could I leverage this somehow in a filter?

Michael Wiktowy

unread,
Aug 11, 2019, 7:28:44 PM8/11/19
to TiddlyWiki
I think that this should work:

"[field:isview[true]] -[[Graphsearch]] -[[Live View]]"

I am assuming here that "isview" is the field name and "true" is the content if it is to be included that folder.

/Mike

TonyM

unread,
Aug 11, 2019, 10:28:34 PM8/11/19
to TiddlyWiki
In fact isview[true] also works

Felix Küppers

unread,
Aug 12, 2019, 1:34:02 PM8/12/19
to tiddl...@googlegroups.com

Hi Steve,

all views are stored below this path

https://github.com/felixhayashi/TW5-TiddlyMap/blob/db7e522bf962447589306817491b4b05e6eff93e/src/plugins/felixhayashi/tiddlymap/js/lib/environment.js#L30

Moreover, as it was mentioned, they have a common boolean "view marker"

https://github.com/felixhayashi/TW5-TiddlyMap/blob/db7e522bf962447589306817491b4b05e6eff93e/src/plugins/felixhayashi/tiddlymap/js/lib/environment.js#L102

If you want to select all views, you can use the  "tmap" macro (a tmap helper macro used by TiddlyMap) to return all views or all view labels.

See the TiddlyMap source code e.g. for the sidebar editor:

https://github.com/felixhayashi/TW5-TiddlyMap/blob/master/src/plugins/felixhayashi/tiddlymap/tiddlers/gui/editor/misc.editor_bar.tid

here you can see the use of the "tmap" macro to return all views by label

<$list filter=<<tmap "option" "selector.allViewsByLabel">> >

you can also get the full tiddler path via

<<tmap "option" "selector.allViews">>

both selectors are stored in this (shadow tiddler) js file

https://github.com/felixhayashi/TW5-TiddlyMap/blob/db7e522bf962447589306817491b4b05e6eff93e/src/plugins/felixhayashi/tiddlymap/js/lib/environment.js#L114

Hope this helps.

Felix

--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/34be9d75-fb46-42be-8c02-cc8ff7fb0f60%40googlegroups.com.

MagoArcade

unread,
Aug 12, 2019, 7:29:19 PM8/12/19
to TiddlyWiki
Thanks for your replies, all. Especially to Felix as that looks ideal - just need to find some time to have a tinker. 

btw, Felix - it was your TiddlyMap plugin and Gould's Dropboard plugin that inspired me to get coding in tw! I'm trying to pull it all together to make a project management application - so thanks for such a great plugin!

Felix Küppers

unread,
Aug 14, 2019, 8:52:22 AM8/14/19
to tiddl...@googlegroups.com

Thanks, glad to hear this :) Developing a project management application sounds interesting, I hope you find a good way to "hack" yourself through TiddlyWiki (and TiddlyMap) to achieve your goal ;)

Regards

Felix

On 8/13/19 1:29 AM, MagoArcade wrote:
Thanks for your replies, all. Especially to Felix as that looks ideal - just need to find some time to have a tinker. 

btw, Felix - it was your TiddlyMap plugin and Gould's Dropboard plugin that inspired me to get coding in tw! I'm trying to pull it all together to make a project management application - so thanks for such a great plugin!
--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages