Hello Paul,

On 2012-01-26 13:13 , Paul Warner wrote:
> Hello,
> 
> I need to be able to preselect the book filter via the query string (
> http://www.hucompute.org/publikationen?select=book, for example).  I have
> tried the code here:

Just to clarify, you mean your use case precludes using the built-in
mechanism of pre-filtering, ex:selection?

> http://www.mail-archive.com/[email protected]/msg02799.html . But it
> just wipes out all my 4 facets, and leaves an empty page.  What I need is
> for the query string value to trigger the book filter, as if it had been
> clicked.  But if I do something like this, with jquery:

It's a solution, but solutions that require you to duplicate code are
fragile.  Nevertheless, that should have worked; did you watch your
error console to see what went wrong?

> $inlineScript = '$(window).load(function(){'
> . '$("a:contains(\'book\')").trigger("click");'
> . 'console.log("just clicked the bookFacet: ");'
> . '});';

I guess this is PHP?  My initial reaction was that this obviously
wouldn't work because it isn't syntactically correct JavaScript - but I
suppose your page is generated by PHP?

> while I know I have the book link, nothing happens with the click event on
> the link.  It is less than ideal, also, to have the whole set of

The event listener isn't on the anchor element, it's on the parent
element.  Try $("div[title='book']") as your selector instead.
Presumably some setting concerning event propagation is preventing the
child click from passing up to the parent.

> publications load, and then to reload only the books.  If I could run the
> scripts the first time with the right publication type facet filter, that
> would be ideal.

Assuming you mean load in the UI when you say "load", you would have to
go in and do some deeper engineering to avoid going from the initial
all-items state to the filtered state.  I suppose you could try to set
ex:selection based on the query string before Exhibit runs through and
processes the DOM.  A deeper solution may exist.

Also, if you're using PHP, you could feasibly get the query parameter
there and write out the value of ex:selection as you send the page; it's
not a self-contained solution, but it would help achieve what you're
aiming for.

> Thanks for any help!
> 
> Regards,
> Paul
> 

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