I’m trying to add extra properties to my event when the scheduler loads:
scheduler.load(srDataSource, function(){
console.log("loaded");
var all_events = this._events;
all_events[1].myproperty = 3;
});
I can’t find a way of iterating through the _events object and adding my properties. How do I get a list of the events? I’ve tried various foreach type methods but nothing seems to be defined.
Is this even the correct way of doing this. Are there any API’s to access the loaded events in a more structured way rather than hacking it?
I don’t think that answers my question! That’s just another way of getting a callback.
I figured out a way of doing it but it feels like a hack:
scheduler.load(srDataSource, function(){
console.log("loaded");
var all_events = this._events;
for (var key in all_events) {
if (all_events.hasOwnProperty(key)) {
all_events[key].my_new_prop = "Hello world";
}
}
scheduler.updateView();
});
It turned out I didn’t need it anyway but I put the code here in case someone else needs it.
As I said earlier this looks like a bit of a hack and my original question was is there a better way (or API) to iterate through the list of events.
Cheers,
David
Hello,
if you want to add some property to each loaded event, you can use onEventLoading event (my previous post). If fires for each event when it’s parsed from the server response
scheduler.attachEvent("onEventLoading", function(ev){
ev.my_new_prop = "Hello world";
return true;
});
docs.dhtmlx.com/scheduler/api__s … event.html
Or you can use scheduler.getEvents method for getting all events from your callback:
docs.dhtmlx.com/scheduler/api__s … vents.html