Is "userdata" supported in DHTMLXScheduler?


I’m wondering if “userdata”, which is available in DHTMLXGrid, is also supported in DHTMLXScheduler. Can you please let me know? Thank you in advance for your help!

There is no userdata in scheduler, as you can add custom attributes to xml tags ( json objects ) and they all will be mapped to the properties of event objects ( so you can provide custom data and access it as part of event objects, without userdata )

<event id="1" mydata="2" ... var t = scheduler.getEvent(1).mydata; //2

Thanks! But the reason I was asking specifically about userdata is that this piece of info is per xml, not per event. I guess I could put the same attribute to all the events, but that looks quite redundant to me. Unless I can put it to the “data” tag as an attribute and access it in some way…

Unfurtunately, to access some data from top-level tag the code need to be modified, because by default it doesn’t provide access to the that data.

You can use separate ajax call

[code]dhtmlxAjax.get(“data.xml”, function(loader){
//get custom attribute
var top = loader.doXPath("//data")[0]
var data = top.getAttribute(“mydata”);

  //load scheduler with the same data


Thanks Stanislav! It worked. I’m also wondering if there is an API for updating the scheduler. I’m currently using “clearAll” and then “load”.

Combination of clearAll and load is the expected usecase, does it have some unwanted side-effects?

I’m using with very little data in our scheduler and I don’t see any undesired behavior so far. I was just wondering if it’ll be different when the scheduler is put to production where the data can be quite large.

It scales quite well, but if in any moment you will encounter performance problem - you may consider usage of dynamic mode ( the same reloading logic will continue to work ) … al_loading

Thanks! As a matter of fact, I do need to use the dynamic loading which wasn’t implemented earlier.

I found a problem though. I can call ‘scheduler.setLoadMode(“month”);’ without any problem if I do ‘scheduler.load(…)’.

But if I do
dhtmlxAjax.get(url, function(loader) {

as you suggested earlier for another problem I had, I get javascript error “‘undefined’ is null or not an object”.

Can you provide a demo link or some kind of sample, where problem can be checked?

Hi, I couldn’t upload any file to the website but reproducing the problem is quite simple.

  1. Add scheduler.setLoadMode(“month”);
  2. Load xml by
    dhtmlxAjax.get(“events2012.xml”, function(loader){
    //get custom attribute
    //load scheduler with the same data
  3. Load the page on a browser (IE in our case);
  4. The moment you resize the page, you’ll see following javascript error:
    Line: 155
    Error: ‘undefined’ is null or not an object

Debugger shows the exceptin happening at line with underline

a+=(a.indexOf("?")==-1?"?":"&")+“timeshift=”+(new Date).getTimezoneOffset();
this.config.prevent_cache&&(a+="&uid="+this.uid());var c,b=b||this._date;

Try to change your data loading code as

scheduler._load_url = "events2012.xml"; dhtmlxAjax.get(scheduler._load_url, function(loader){ ...

Thanks a lot! It worked. :slight_smile: