On Sunday, May 8, 2016 at 2:01:07 AM UTC-7, Tobias Beer wrote: > > Hope I didn't get too rusty since March. > > I am struggling to formulate a filter logic for batch operations > <https://groups.google.com/d/msg/tiddlywiki/hvLUL0fbxeE/E3Z5d1b7AwAJ> > that allows to specify a filter whereas when the filter yields... > > - results => shows a button to delete all those tiddlers > - no results => does not show a button since there are not tiddlers to > be deleted > > The filter is specified by the user in an input field. > Feels like a filter to model this conditional logic isn't quite there yet, > is it? > > <$list filter="[foo[bar]is[emptyList]]"> > <$button>foo</$button> > </$list> > > What I am *not* looking for is to just > see if some value in a tiddler field is empty or not > <https://github.com/Jermolene/TiddlyWiki5/pull/2186>, > although I am not sure that that would exist either (in a simple solution). >
To conditionalize output based the empty/non-empty state of the filter results, use the *emptyMessage* param in the $list widget. To make things more readable, I tend to put the output rendering code into separate macros, thus: \define showitem() <$button>{{!!title}}</$button> \define showempty() no items \define filter() [foo[bar]] <$list filter=<<filter>> emptyMessage=<<showempty>>> <<showitem>> </$list> enjoy, -e P.S. welcome back -- 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+unsubscr...@googlegroups.com. To post to this group, send email to tiddlywiki@googlegroups.com. Visit this group at https://groups.google.com/group/tiddlywiki. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/9ac6a08d-9bb0-4571-885c-caf43dc17bc5%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.