Roberto wrote:
> Dear all,
>
> Is it possible to dynamically generate the facets from the properties
> present in the data being loaded? Is there any Javascript code to do
> so, i.e. generate the divs for the facets dynamically while processing
> the data to be displayed?
>
> Best regards,
>   
Roberto,

Yes, it's possible. First, turn off Exhibit's auto-creation by appending 
?autoCreate=false after exhibit-api.js. Then do something similar to the 
code here
    http://api.simile-widgets.org/exhibit/2.2.0/scripts/create.js
to create the exhibit yourself. But right after the call 
configureFromDOM(), you can inspect the database with
    var arrayOfPropertyIDs = database.getAllProperties();
(implemented in this file
    http://api.simile-widgets.org/exhibit/2.2.0/scripts/data/database.js )
And then you can generate facets as follows
    var aDiv = document.createElement("div");
    document.body.appendChild(aDiv);
    var facet = Exhibit.ListFacet.create({ "expression": ".foo" }, aDiv, 
exhibit.getUIContext());
    exhibit.setComponent("facet-foo", facet);
The list facet is implemented here
    
http://api.simile-widgets.org/exhibit/2.2.0/scripts/ui/facets/list-facet.js

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
-~----------~----~----~----~------~----~------~--~---

Reply via email to