Hi,

Firebug or a reasonable Javascript console will help immensely.

On 9/11/11 5:04 PM, IP wrote:
> Hi,
> 
> I was just wondering if anybody know how to do a bunch of actions in
> Exhibit programmatically. Here's what I'm looking for:
> 
> 1) Getting an object/array wever of all the items in the current
> filtering (the current view consists of items [x,y,z,...]).

Become familiar with Exhibit.Set.  Exhibit works with the mathematical
concept of sets when returning things like that.

http://api.simile-widgets.org/exhibit/2.2.0/scripts/util/set.js

Exhibit also runs on Collections.  There may be more than one Collection
at play, so you need to know which Collection you're dealing with.  If
you know you've only got one, you can retrieve the default Collection.

http://api.simile-widgets.org/exhibit/2.2.0/scripts/data/collection.js

window.exhibit.getCollection("default").getRestrictedItems()

> 2) Setting my own buttons that trigger filtering events in exhibit
> (e.g. I want to set up my own filter that filters simultaneously
> filters x,y and z by values x1,x2,y1,z2).

So long as you have a corresponding facet / set of facets these buttons
correlate to.  You could hide them in the UI if need be, but the
filtering as it relates to all facets and views is run through the Facet
object logic to keep it consistent.

window.exhibit.getCollection("default").applyRestrictions([Array of
restrictObject])

where restrictObject = {
  "selection": [ Array of facet values to restrict ],
  "selectMissing": [boolean]
};

Each facet gets its own restrictObject in order; see the implementation
of Collection.applyRestrictions.

> 3) Setting my own subset of items in view that I can't do with any
> particular filtering (e.g. I want to show items 1,2 and 5-10 in the
> current view and export those items)

Nothing comes to mind as being natively available for this, but you
could possibly design a new type of facet that picks matching items
according to your non-facetable criteria, instead of what you may be
used to a facet doing.  I guess I would do that by making the functions
in the facet return the set of items you want to show without bothering
to query the database.  Look at the list facet, especially
applyRestrictions and restrict, which uses the FacetUtilities.Cache
mechanism (you might want to skip that).

http://api.simile-widgets.org/exhibit/2.2.0/scripts/ui/facets/list-facet.js
http://api.simile-widgets.org/exhibit/2.2.0/scripts/util/facets.js

Finally, you might want to look over Exhibit 3.0 instead.  We're looking
to document and refine the API a bit better in that version.

https://github.com/zepheira/exhibit3/wiki


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