Dynamically updating Exhibit.

29 views
Skip to first unread message

nunb

unread,
Sep 24, 2009, 9:45:46 AM9/24/09
to SIMILE Widgets
Hello,

I wonder if it's possible to update Exhibit in real-time, with fresh
data. Is there any way of getting data into Exhibit, other than this
sequence in the html head?

<head>
<link href="../../json/policies-explorer" type="application/json"
rel="exhibit/data" />
..stuff..
</head>

Searching for any mention of "exhibit/data" in the source has so far
yielded no clues, and these lines (248 onwards in exhibit.js) seem to
be the closest I can find:

var uiContext = this._uiContext;
for (var i = 0; i < collectionElmts.length; i++) {
var elmt = collectionElmts[i];
var id = elmt.id;
if (id==null || id.length == 0) {
id = "default";
}
this.setCollection(id, Exhibit.Collection.createFromDOM2(id,
elmt, uiContext));
}

Lastly, in case anyone else is looking for it, to get the current set
of "label" or "id" elements of items that have currently been selected
(via filtering) one should be able to use this javascript snippet
(using, Firebug's console, for example):

window.exhibit.getDefaultCollection().getRestrictedItems().toArray();

mleden

unread,
Sep 24, 2009, 12:34:01 PM9/24/09
to SIMILE Widgets
Have you considered a database to supply the data? This works nicely
for us.

Architecturally, we have:
Data layer (in our case MySQL)
Transition layer (in our case PHP script queries and transforms to
JSON format)
Presentation layer (SIMILE Exhibit and/or other widgets/frameworks)

The data is updated directly in the DB and reflected realtime in the
front end (only requiring a browser refresh).

-Mark

David Karger

unread,
Sep 24, 2009, 12:47:19 PM9/24/09
to simile-...@googlegroups.com
here's a nice example of a dynamically updated exhibit:
http://www.epispider.org/

nunb

unread,
Sep 25, 2009, 5:43:19 AM9/25/09
to SIMILE Widgets
> Have you considered a database to supply the data?  This works nicely

I do have a database, I'm just wondering how to dynamically update the
Exhibit with a fresh set of data. So far digging through the js has
brought me to:

exhibit._database.loadDataLinks();

.. which seems to be a function I can modify to get a new set of JSON/
XHR data on the fly.

nunb

unread,
Sep 25, 2009, 5:45:53 AM9/25/09
to SIMILE Widgets

On Sep 24, 6:47 pm, David Karger <kar...@mit.edu> wrote:
> here's a nice example of a dynamically updated exhibit:http://www.epispider.org/

This looks promising, thanks. Most of getting to the bottom of this is
figuring out how the various parts (database, loaders, bootstrapping)
of Exhibit's javascript fit together..

nunb

unread,
Sep 25, 2009, 5:47:51 AM9/25/09
to SIMILE Widgets
> be the closest I can find:
>
>  var uiContext = this._uiContext;
>     for (var i = 0; i < collectionElmts.length; i++) {
>         var elmt = collectionElmts[i];
>         var id = elmt.id;
>         if (id==null || id.length == 0) {
>             id = "default";
>         }
>         this.setCollection(id, Exhibit.Collection.createFromDOM2(id,
> elmt, uiContext));

That was a false start. If anyone is trying to do something similar,
take a look at loadDataLinks (which is also used in the epispider link
posted below).

>  window.exhibit.getDefaultCollection().getRestrictedItems().toArray();

This works when the exhibit object is already loaded and the data's
been retrieved.
Reply all
Reply to author
Forward
0 new messages