[Exhibit] Hiding facets when items miss a field

19 views
Skip to first unread message

Ricardo Niederberger Cabral

unread,
Apr 16, 2011, 10:04:51 AM4/16/11
to SIMILE Widgets
Hi. How can I hide a facet if all items in my data miss a field?

For example, at http://open.mflask.com/datasets?_v=submitted_by=http://ckan.net/
you can see several facets whose fields are not present on the current
search results and it would make sense to hide them (Date released,
Publisher, ...).

Is it possible?

Thanks!

dhinostroza

unread,
Apr 23, 2011, 8:39:18 AM4/23/11
to SIMILE Widgets
Hi Ricardo,
perhaps this snippet with two examples might help:
<div ex:role="lens">
<div ex:if-exists=".publisher" class="year"><b>Publisher:</b> <span
ex:content=".publisher"></span> </div>
<div ex:if-exists=".date_released" class="year"><b>Date released:</
b> <span ex:content=".date_released"></span></div>

Best,
Daniel

On 16 abr, 09:04, Ricardo Niederberger Cabral <rnc...@gmail.com>
wrote:
> Hi. How can I hide a facet if all items in my data miss a field?
>
> For example, athttp://open.mflask.com/datasets?_v=submitted_by=http://ckan.net/

Ricardo Cabral

unread,
Apr 24, 2011, 5:43:35 PM4/24/11
to SIMILE Widgets
Thanks Daniel. But your example applies for hiding missing properties
inside a view, but I wanted to hide a facet when none of the items
currently loaded have that property. It's silly to show facets with a
single selection "(missing this field)".

dhinostroza

unread,
Apr 25, 2011, 10:09:55 PM4/25/11
to SIMILE Widgets
You can hide facets on the sidebar altogether. See this example:
BEFORE:
<td id="sidebar">
<div ex:role="facet" ex:height="15em" ex:expression=".date_released"
ex:facetLabel="Date released"></div>
<div ex:role="facet" ex:height="15em" ex:expression=".country"></div>
<div ex:role="facet" ex:height="7em" ex:expression=".publisher"
ex:facetLabel="Publisher"></div>
<div ex:role="facet" ex:height="7em" ex:expression=".department"
ex:facetLabel="Department"></div>
<div ex:role="facet" ex:height="7em" ex:expression=".license"
ex:facetLabel="License"></div>
<div ex:role="facet" ex:height="7em" ex:expression=".author"
ex:facetLabel="Author"></div>
<h2>Search</h2>
<div ex:role="facet" ex:facetclass="TextSearch"></div>
</td>

AFTER:
<td id="sidebar">
<div ex:role="facet" ex:height="7em" ex:expression=".license"
ex:facetLabel="License"></div>
<div ex:role="facet" ex:height="7em" ex:expression=".author"
ex:facetLabel="Author"></div>
<h2>Search</h2>
<div ex:role="facet" ex:facetclass="TextSearch"></div>
</td>

I don't know how to make "if-exists" on the sidebar though. Post back
if you find the string.

Best,
Daniel
Reply all
Reply to author
Forward
0 new messages