Finally here we go
http://www.unifr.ch/dokpe/paperj/exhibit_new.html
The offensive part was
var fLoadSubmissions = function()
{ window.database.loadSubmissionLinks(fDone); };
Exhibit.Authentication.authenticate(); //gives an error when the page
is reloaded
window.database.loadDataLinks(fLoadSubmissions); //gives an error even
if the previous line was rem out, and the fDone function was never
called
Replacing the above code with these to lines:
window.database = Exhibit.Database.create();
window.database.loadDataLinks(fDone);
modifiying the ex:selection attribute works before calling
window.exhibit.configureFromDOM().
Using
document.getElementById(i).setAttribute("ex:selection",selection[i]);
instead of of the four lines
var filter = selection[i].split(";");
var facet = exhibit.getComponent(i);
var newRestrictions = { selection: filter, selectMissing: false };
facet.applyRestrictions(newRestrictions);
Thanks for the help !
Francois
On Feb 25, 8:52 am, David Huynh <[email protected]> wrote:
> Francois,
>
> Have you figured this out? I looked at
> http://www.unifr.ch/dokpe/paperj/exhibit.html?fp_pub=Elsevier
> in Google Chrome and the first facet is filtered to Elsevier, as expected.
>
> David
>
> Francois wrote:
> > I can't get it:
>
> > 1) starting from my present working page removing the callback
> > parameter, replacing it
> > with onLoad call,
> > the code
> > var facet = exhibit.getComponent("fp_pub")
> > var newRestrictions = { selection: ["Elsevier"], selectMissing:
> > false };
> > facet.applyRestrictions(newRestrictions);
>
> > does not set any filter.
>
> > 2) I can't have any result with David's solution. The code
>
> > document.getElementById("fp_pub").setAttribute
> > ("ex:selection","Elsevier");
> > or
> > document.getElementById("fp_pub").setAttribute("ex:selection",
> > ["Elsevier"]);
>
> > is without effect, beeing called before or after
> > window.exhibit.configureFromDOM();
>
> > Francois
>
> > On Feb 15, 6:57 pm, David Huynh <[email protected]> wrote:
>
> >> Francois wrote:
>
> >>> Sorry I had & in the url instead of ?...
>
> >>> The function take the parameters from the url and set the selection in
> >>> the facets accordingly
> >>> for example
> >>> :http://www.unifr.ch/dokpe/paperj/exhibit.html?fp_pub=Elsevier.
> >>> The names of the parameters are the id of the facets and the values
> >>> are used to select the data.
>
> >>> Now I still have a question: is it possible to set the selection(s) in
> >>> the facet(s) before loading all the data ?
> >>> For the moment, all the lines are loaded and after the selection is
> >>> done.
>
> >>> The code that set the selection can be seen in the header of the page
> >>> above.
>
> >>> By the way it would had help if the doc has said that the calledback
> >>> function has to be placed in the header before the call to url
>
> >> One way to do this is to take over the auto-creation process, which is
> >> implemented here
>
> >> http://static.simile.mit.edu/exhibit/api-2.1.0/scripts/create.js
>
> >> What you need to do is to add ?autoCreate=false after exhibit-api.js
>
> >> <script src="........../exhibit-api.js?autoCreate=false"></script>
>
> >> Then add an onload handler to <body>
>
> >> <body onload="onLoad();">
>
> >> And make a copy of the code in create.js and put it into an onLoad
> >> function. But right before
>
> >> window.exhibit.configureFromDOM();
>
> >> you can parse the URL of the whole document, get the fp_pub parameter,
> >> and then set the ex:selection attribute of the corresponding facet element.
>
> >> document.getElementById("the-fp-facet").setAttribute("ex:selection",
> >> "Elsevier");
>
> >> where
>
> >> <div id="the-fp-facet" ex:role="facet" ...
>
> >> 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
-~----------~----~----~----~------~----~------~--~---