Thanks for pointing that out, John, I'd forgotten about it.  For
ex:ondataload, given that that snippet of code contains what's in the
initial value of fDone in create.js, yes, that would accomplish the same
thing (remember the namespace on ex:ondataload, create.js is only
looking for that).

There are callbacks for loading JSONP, which are described here:

http://simile.mit.edu/wiki/Exhibit/How_to_make_an_exhibit_from_any_JSONP_data_source

which is for a different purpose unrelated to what and when to run
Exhibit's initialization.

John Callahan wrote:
> Very cool.   Thanks Ryan, I was curious about this as well.  Just 
> curious but is it also possible to do the same with <body 
> ondataload="myFunction"> and putting the same create.js code in there? 
> 
> I also read that you can define a callback function in the url.  
> Something like adding ?callback=myFunction.    Or, add a callback 
> function in the link when referencing exhibit-api.js.   I would assume 
> that the callback function would run after the exhibit code.   Is this 
> possible?
> 
> - John
> 
> 
> 
> Ryan Lee wrote:
>> SIMILE's loading is through jQuery.  The route to it is the global
>> variable/method SimileAjax.jQuery().
>>
>> To write your own onload method, you should attach ?autoCreate=false to
>> the <script> tag's src that loads in the Exhibit API.  Then write your
>> own SimileAjax.jQuery(document).ready(...) handler that includes the
>> core of what's in the Exhibit create.js file.
>>
>> http://code.google.com/p/simile-widgets/source/browse/exhibit/trunk/src/webapp/api/scripts/create.js
>>
>> I think you can combine that with Niels' code to get you where you're
>> aiming.
>>
>> mleden wrote:
>>   
>>> Thanks Ryan & Niels for your responses.  Using your suggestions, I've
>>> *almost* got the behavior I want.  One thing I haven't been able to
>>> figure out is how to switch to a particular view based on a value in
>>> the URL's query string.  I've tested and the query string is getting
>>> parsed correctly and I know that the function to switch views works.
>>> My guess is that my onload function is getting stomped by SIMILE's
>>> events.
>>>
>>> Has anyone had success doing something like that?
>>>
>>> Thx,
>>> -Mark
>>>
>>>
>>> On Aug 21, 10:42 pm, Niels Mayer <[email protected]> wrote:
>>>     
>>>> One way to "navigate to a viewpanel" is programmatically.
>>>>
>>>> Assuming you have a viewpanel containing views declared:
>>>>    <div ex:role="viewPanel" id="vp">
>>>>      <div ex:role="view" ##exhibit.getComponent("vp")._switchView(0);
>>>>       > ... </div>
>>>>      <div ex:role="view" ##exhibit.getComponent("vp")._switchView(1)
>>>>      > ... </div>
>>>> ...
>>>>   </div>
>>>>
>>>> You can programmatically switch to the  i-th viewpanel  (0-based)  with
>>>> exhibit.getComponent("vp")._switchView(i)
>>>>
>>>> Or alternately, my utility function, switchView("vp", i) switches to the
>>>> i-th declared viewpanel, returning true,
>>>> or returns false if already showing. When it returns false, it also means 
>>>> it
>>>> hasn't destroyed/recreated the contents
>>>> of viewpanels in the process of switching, due to the way viewpanels are
>>>> implemented).
>>>>
>>>> /****************************************************************************
>>>>  * switch viewpanels if not already showing, returning true. if already
>>>>  * showing return false.
>>>>  
>>>> ****************************************************************************/
>>>> function switchView(viewpanel_name, idx_in_viewpanel) {
>>>>   var viewpanel = exhibit.getComponent(viewpanel_name);
>>>>   if (viewpanel) {
>>>>     if (viewpanel._viewIndex != idx_in_viewpanel) {
>>>>       viewpanel._switchView(idx_in_viewpanel);
>>>>       return true;
>>>>     }
>>>>     else {
>>>>       return false;
>>>>     }
>>>>   }
>>>>   else {
>>>>     alert("switchView('" + viewpanel_name + "'," + idx_in_viewpanel + "):
>>>> viewpanel not found - '" +  viewpanel_name + "'.");
>>>>   }
>>>>
>>>> }
>>>>
>>>> Nielshttp://nielsmayer.com
>>>>
>>>>       
>>
>>   
> 
> > 
> 


-- 
Ryan Lee                  [email protected]
http://simile.mit.edu/

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