Our pure JavaScript Scheduler component


Post by gitdev »

Hi,

I have two use cases regarding data modification:
1. Data can be modified by other backend systems.
2. Data can be modified in the Scheduler by the user.

My backend server will push updated data when something changes in an external system to display it in the scheduler. Exemple notify on what has changed: new event, information of event YYYY has been updated or event ZZZZ has been deleted. I'd then modify the eventStore programatically.

The user can also modify the data directly in the scheduler. So, I want to follow this tutorial to make the scheduler saves modification to my backend server when the user modifies things in the Scheduler: https://www.bryntum.com/docs/scheduler/ ... axstore.md

From reading the tutorial, I feel that things will get complicated because if I programatically modify the data in the scheduler when I receive notification from other systems, the Scheduler will think that it was modified by the user. It will therefore save the modification again in the backend. Is that correct ?

What is the right way to make such a scenario with Bryntum Scheduler ?

Post by pmiklashevich »

Hello,

Seems you're looking for a saving strategy. If I get you right you're trying to implement something like google docs. I mean a service which autosyncs with main server and makes possible working many users at the same time on one document. Am I right? If so, I'm afraid we don't have ready-to-use solution for you.

It sounds like each minute you ask the server if the data has been changed since the last check and if it is, you update the local data. But the thing is that the data layer doesn't distinguish if it's been done by you (programmatically) or by your users (manually).

A possible solution could be is to "stash" the local changes somehow, load/sync the store and apply fresh result, and then "unstash" the changes. But likely you'll get conflicts if some local changes interacts with the fresh update and you'll have to have a strategy to solve that conflicts.

Another possible solution is to store programmatic changes in some meta object to be able to distinguish them. And on beforeCommit remove those values from the change object.

Anyway it looks like complex stuff that requires to be really careful with data!

Docs of Crud Manager and AjaxStore could be useful for you. Also you might be interested in State Tracking Manager. It tracks the local changes and store them in a queue. It can undo/redo them if needed.

Back to your questions:
From reading the tutorial, I feel that things will get complicated because if I programmatically modify the data in the scheduler when I receive notification from other systems, the Scheduler will think that it was modified by the user. It will therefore save the modification again in the backend. Is that correct ?
Yes, that's correct!
What is the right way to make such a scenario with Bryntum Scheduler ?
That is not supported out of the box.

I hope you'll find your way to work with the data.

Best wishes,
Pavel

Pavlo Miklashevych
Sr. Frontend Developer


Post by mathsewell »

Hi,

Just to jump in on this, we've just written an implementation that does this. We originally looked at the Crud manager but ended up doing it with STM and Ajax stores as that gave us better control.

We're currently testing with the scheduler refreshing it's events every 5 seconds and that seems to work pretty well.

Hope that helps,

Matt

Post by Landpoint »

I assume you mean something like a WebSocket style of a push to the clients?
We in our previous version of a scheduler soultion used a web sockets based solution and pushed all updated up and down from a central server. Each client would have a web socket listener, and on new events we would just add/remove the data from the locally stored data.

With the Bryntum scheduler, it is just a matter of adjusting the event store, so, if you can handle receiving the notification from the websocket, then you just modify the event store accordingly.
The way we implemented it, was we just sent add/edit/delete type of commands to the client

Post by mats »

Great discussion! We'll aim at creating a full demo showing multi-user edits and live push later this year. We made this demo with socket.io a few years back https://www.youtube.com/watch?v=00gEx2_Lcr4

Post by gitdev »

Thank you very much guys for the input. Much appreciated !

Post Reply