Events not loaded after initialization

Hello,

my javascript code looks like this:

  scheduler.init('scheduler_here', null, "users"); // "users" is a unit view
  scheduler.setLoadMode("month");
  scheduler.load("/events.xml");

  var dp = new dataProcessor("/events.xml");
  dp.init(scheduler);
  dp.setTransactionMode("POST",false);

until this point everything works fine. If I let the scheduler start like that it’ll work just fine.

However, what I would like to do, is to start it and directly jump into some event. Like this:

 event="37";
 scheduler.setCurrentView( scheduler.getEventStartDate(event), "users");
 scheduler.showLightbox(event);

That works if I try it from the loaded scheduler from Firebug however if I add it to my initialization code it will fail, because:

  scheduler.getEventStartDate(event);

or even:

  scheduler.getEvent(event);

(which is called from within showLightbox() will not find any events, because, aparently they haven’t been loaded yet).

I’m a bit stumped. I’d be glad to understand at which point data is fetched from the server and how I can trigger a fetch.

Thanks a lot,
*t

Hello,

loading is asynchronous. Therefore, you need to call methods, which require events, from loading event handler, the second parameter of the load() method:

[code]
scheduler.load("/events.xml",doAfterLoading);

function doAfterLoading(){
var event=“37”;
scheduler.setCurrentView( scheduler.getEventStartDate(event), “users”);
scheduler.showLightbox(event);
});[/code]

You rock! I applied to renew our support with you! Thanks a lot!
*t