[TW5] <$list filter How to show empty list, if filter show less than two items?

220 views
Skip to first unread message

sini-Kit

unread,
Dec 5, 2016, 12:05:45 PM12/5/16
to TiddlyWiki
Hi I have a simple filter <$list filter="[tag[ListWidget]]"/>   I want this list show items only if they more than one. if there is no items in my list or only one item, filter must show empty list.

PMario

unread,
Dec 5, 2016, 12:52:27 PM12/5/16
to TiddlyWiki
Hi,

Have a look at the list widget [1] "empty" parameter. ... But it only works for filters, that return no result. Hence the name "emptyMessage"

I'm confused a bit. 1 item is not empty. At least not for me? ... Your use case also raises some questions for me, which you didn't describe in the OP.

eg:

 - filter returns A -> should be empty
 - filter returns B -> should be empty
 - filter returns B and A -> should be shown. ... but how. Show A or B or Both? ... Is the order important?

-m

[1] http://tiddlywiki.com/#ListWidget

sini-Kit

unread,
Dec 5, 2016, 1:42:27 PM12/5/16
to TiddlyWiki
- I have 3 tiddlers with tag ListWidget A, B, C my filter must show A, B, C
-  I have 2 tiddlers with tag ListWidget A, B my filter must show A, B
-  I have 1 tiddler with tag ListWidget A my filter must show "empty"
-  I have 0 tiddler with tag ListWidget  my filter must show "empty"

I try somethink like

<$list filter="[tag[TableOfContents]sort[title]nth[2]]">
<$list filter="[tag[TableOfContents]]"/>
</list>

but it don't work.

понедельник, 5 декабря 2016 г., 20:52:27 UTC+3 пользователь PMario написал:

PMario

unread,
Dec 5, 2016, 2:23:05 PM12/5/16
to tiddl...@googlegroups.com
On Monday, December 5, 2016 at 7:42:27 PM UTC+1, sini-Kit wrote:
<$list filter="[tag[TableOfContents]sort[title]nth[2]]">
<$list filter="[tag[TableOfContents]]"/>
</list>   <- ... is there a typo

imo should be </$list> ...


for me this:

\define empty()
empty
\end

<$list filter="[tag[a]sort[title]nth[2]]" emptyMessage=<<empty>> >
  <$list filter="[tag[a]]"/>
</$list>


seems to work. I did use a macro for the empty message, because it has more possibilities.

have fun!
mario

Siniy-Kit

unread,
Dec 6, 2016, 5:08:10 AM12/6/16
to TiddlyWiki
unfortunately it didn't solve my problem

I try to modify my pure css3dslider for external images
and here is the code of this slider https://design4shop.ru/heeg.html#3dslider

this slider shows little previews under photos, and if i have only ONE photo, this one under photo is not necessary.

So at the end of this code i try to write

 <$list filter="[is[current]tagging[]type[image/jpeg]sort[title]nth[2]]"><$list filter="[is[current]tagging[]type[image/jpeg]sort[title]]"> <label for={{!!title}} class="arrows_th" >  <img  src={{!!_canonical_uri}}  alt={{!!alt}}/>   </label> </$list></$list>

but this filter shows nothing. i think my problem with is[current]tagging[]......






  <$list filter="[is[current]tagging[]type[image/jpeg]sort[title]nth[2]]"><$list filter="[is[current]tagging[]type[image/jpeg]sort[title]]"> <label for={{!!title}} class="arrows_th" >  <img  src={{!!_canonical_uri}}  alt={{!!alt}}/>   </label> </$list></$list> 



понедельник, 5 декабря 2016 г., 22:23:05 UTC+3 пользователь PMario написал:

PMario

unread,
Dec 6, 2016, 5:44:33 AM12/6/16
to TiddlyWiki
On Tuesday, December 6, 2016 at 11:08:10 AM UTC+1, Siniy-Kit wrote:
So at the end of this code i try to write

 <$list filter="[is[current]tagging[]type[image/jpeg]sort[title]nth[2]]"><$list filter="[is[current]tagging[]type[image/jpeg]sort[title]]"> <label for={{!!title}} class="arrows_th" >  <img  src={{!!_canonical_uri}}  alt={{!!alt}}/>   </label> </$list></$list>

but this filter shows nothing. i think my problem with is[current]tagging[]......

yes. I do think so too. The first <$list widget changes the currentTiddler, which the second <$list is[current] tries to use again. .. just a guess. no testing done.

You may use the list-widget: variable   attribute. in the first list.
eg: <$list filter="[is[current]tagging[]type[image/jpeg]sort[title]nth[2]]" variable=test>

As I wrote. Just a guess. ... But that's the way I'd start to search.
-mario

Siniy-Kit

unread,
Dec 6, 2016, 7:27:29 AM12/6/16
to TiddlyWiki
Thank you Mario! It's a magic! with your "variable=test" it works as I want!

вторник, 6 декабря 2016 г., 13:44:33 UTC+3 пользователь PMario написал:

PMario

unread,
Dec 6, 2016, 8:10:50 AM12/6/16
to TiddlyWiki
On Tuesday, December 6, 2016 at 1:27:29 PM UTC+1, Siniy-Kit wrote:
Thank you Mario! It's a magic! with your "variable=test" it works as I want!

Cool! Glad that it worked out :)
-m
Reply all
Reply to author
Forward
0 new messages