Our pure JavaScript Scheduler component


Post by aymenmzz »

Hello everyone,
I want to create an event on the schedulerPro, but I don't want to follow the classical flow of the schedulerPro changes, here is the flow that I want to follow :

A schedulerPro event triggers some changes, these changes are sent to a backend server that processes the changes and sends back the data to the frontend. The frontend then handles the changed data in a redux store, and then the changes are applied to schedulerPro eventStore, assignmentStore and resourceStore dependening on the nature of the changes (update, delete, create).

But when I want to add an event in the eventStore using eventStore.add, the first time, the first element of the eventStore records disappears on the UI (though still being on the
eventStore data), and for every other time after the first one, the last created event disappears (again only on the UI).
Let's take a set of 4 events as an example {A, B, C, D} :
When I try to add event E on scheduler (1st time), A dissapears after E is added.
Then when I try to add event F on scheduler (2nd time), E disappears after F is added.
Then when I try to add event G on scheduler (3rd time), F disappears after G is added.
And so on...
And whenever A, E and F dissapear on the UI, they are still visible on the logs of the eventStore data.

Here is the code I used to handle the adding of an event; I take the project ref and the changedData as parameters, I extract propper event and assignment data from it, and then I add in both stores :

const handleEventAdd = (project, data) => {
  const { assignmentStore, eventStore } = project.current.instance;
  eventStore.add(getEvents(data));
  const assignments = getAssignments(data);
  assignmentStore.add(assignments);
};

My question is the following : Is there something wrong in my way of adding an event, or is there a bug that causes this situation ? I have been looking for alternatives for the past 2 days (that all implied the eventStore.add in the end) and all the alternatives pointed to the same problem quoted above (i.e dissapearing of events).

NB : I use the id field as the id of an event and it's a large number, not a string (maybe that piece of information can help).


Post by marcio »

Hey aymenmzz,

That looks like really strange behavior, we don't have a similar report here, so we would need a deeper investigation on that case.

We have a demo with React + Redux here https://bryntum.com/products/schedulerpro/examples-scheduler/frameworks/react/javascript/advanced/build/ maybe that could help you with some way of implementation.

Besides that, the piece of code that you shared doesn't look wrong, but just to clarify, the getEvents/getAssignments are async functions or not??

The id field with a large string shouldn't be a problem.

If you could provide a sample project with your configuration, that would be a lot easier/faster for us to check what's happening there. You can take that demo that I shared and adapt to your case with the buggy behavior and then share it with us here. Please check our guidelines for more information https://www.bryntum.com/forum/viewtopic.php?f=1&t=772

Looking forward to your feedback.

Best regards,
Márcio


Post by aymenmzz »

Hi Marcio,

The functions getEvents and getAssignments are not async, they are synchronous functions to format the data in the proper shape so that it fits into the bryntum stores (eventStore and assignmentStore) for the schedulerPro update.

Thank you for the link regarding React + Redux, but I cannot see any code to compare the demo's logic and mine. Do you know where could I find the source code please (that would help me a lot) ?

Thank you.


Post by alex.l »

Hi,
All the source code for our demos you can find in /examples folder of sources you downloaded in CustomerZone.
Exactly that demo is placed in /examples/frameworks/react/javascript/advanced folder.

All the best,
Alex


Post Reply