TW5 how to use 'filters' with TW5 javascript API

65 views
Skip to first unread message

Alain Dutech

unread,
Mar 11, 2016, 6:32:11 PM3/11/16
to TiddlyWikiDev
Hello,

I would like to use à filter expression (for example "[tag[chapter]!is[system]sort[]]") inside a javascript plugin.
Do you have ideas of what tiddlywiki function to use ? Any example in the boot/core/plugins javascript files ?

Thank you,
Snow

BJ

unread,
Mar 12, 2016, 4:17:04 PM3/12/16
to TiddlyWikiDev
Hi Alain,

in the list widget the code is

ListWidget.prototype.getTiddlerList = function() {
    var defaultFilter = "[!is[system]sort[title]]";
    return this.wiki.filterTiddlers(this.getAttribute("filter",defaultFilter),this);
};


so you would use

this.wiki.filterTiddlers("[tag[chapter]!is[system]sort[]]");

which would return an array of tiddler titles

all the best

BJ

Alain Dutech

unread,
Mar 14, 2016, 2:43:58 PM3/14/16
to tiddly...@googlegroups.com
Thank you very much indeed.
Alain

--
You received this message because you are subscribed to a topic in the Google Groups "TiddlyWikiDev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tiddlywikidev/hhz0buCJ604/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tiddlywikide...@googlegroups.com.
To post to this group, send email to tiddly...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywikidev.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywikidev/ff607a22-874e-4941-b8a4-4c4711f01d3c%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages