Looking for more complete example of server-side scheduler on nodejs

So, I’m a tad new to the scheduler, but I’m pretty good with nodejs.

I have started with, and gotten running the node-scheduler-demo example. And I’m looking to expand.

So, it looks like there is an /init end point with sends all the scheduling data to the scheduler, I assume there is a way to do more “on demand” loading, but I got a little lost in the documentation.

Perhaps some one could help me out? Thanks a ton!

Hi,

By default, dhtmlxScheduler loads all data at once.
There is only one alternative way that can be useful for you if you load big event collections. It is the dynamic loading mode when data is loaded by parts, necessary to fill the current viewable area of the scheduler.
It can be implemented by setLoadMode method. Please read more in this guide
https://docs.dhtmlx.com/scheduler/loading_data.html#dynamicloading

Ah, that helped a lot thanks!

is there anything special about IDs other than they need to be unique?

I noticed that when events get created they come with an ID already (which looks like a UNIX timestamp). Is it important to preserve that when persisting it to the database?

Also, I noticed in the nodejs example that it returns an sid and a tid what are those exactly? I’m quessing one is a schedule-id and the other a transaction id or something? Is that documented somewhere?

id cannot be null or “0”. In common you may use any string to be the id of your event.
About:

var sid = data.id;
    var tid = sid;

sid - it is the “source” id, saved in the event on the client-side before it is saved in the database. It is a “temporal” id.
tid - “target” id. as the event will be saved in your database, it will have a unique id for your database, and the event will also get this id after the successfull saving.

I see, so when I provide a response, I should provide the sid (source ID that I was given) and the tid (the new id from the database) and the client adjusts to that?

Also, is there some documentation on how to deal with errors? Like if there is a failure in the DB for exampe?

You may try to use onLoadError/onSaveError events of the dhxScheduler.
https://docs.dhtmlx.com/scheduler/api__scheduler_onloaderror_event.html
https://docs.dhtmlx.com/scheduler/api__scheduler_onsaveerror_event.html

1 Like

Oh that’s perfect. thanks!