neyric wrote:
> Hi,
>
> I made a big mashup with exhibit where I merge items from multiple
> sources:
> delicious,twitter,flickr,rss feeds, and local data:
> http://neyric.com/~neyric/exhibit/
>
> I'd like to know if there is a way to display facets conditionnaly.
> Examples:
> * when I select "Document" in the "Type" facet, I would like to
> display a new facet "File type"
> * when I select "Project", I would like to display a "Year" facet
> * when I select "Article", I would like to display a "Source" facet
> ...etc...
>
> Thanks
>
That's a pretty interesting mashup!
There's no native support in Exhibit to do what you want to do, but you
can use some Javascript to implement it. It's a bit complicated. First,
give your Type facet an ID
<div ex:role="facet" id="the-type-facet" ...
and other facets some other IDs.
Then, you need to turn off autoCreate: when you include exhibit-api.js,
add ?autoCreate=false to the end of that URL. Then add a copy of the
code in this file
http://static.simile.mit.edu/exhibit/api-2.1.0/scripts/create.js
but add some more code to the end of the fDone function:
var facet = window.exhibit.getComponent("the-type-facet");
facet.applyRestrictions = function(restrictions) {
Exhibit.ListFacet.prototype.applyRestrictions.call(this,
restrictions);
document.getElementById("file-type-facet").style.display = "none";
...
for (var i = 0; i < restrictions.selection.length; i++) {
var selectedType = restrictions.selection[i];
switch (selectedType) {
case "Document" :
document.getElementById("file-type-facet").style.display =
"block";
break;
...
}
}
};
You get the idea...
David
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"SIMILE Widgets" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/simile-widgets?hl=en
-~----------~----~----~----~------~----~------~--~---