Our powerful JS Calendar component


Post by joversdev »

Hi,

(Note that the following calendar setup is using the crudManager with autoLoad and autoSync enabled on the BryntumCalendar React Wrapper)

How do I stop the calendar from loading resources in the resourceCombo in the eventEditor without my choosing when I am creating a new event? This seems to be causing a bug where it thinks the event already exists and it needs to send an assignment under "remove" to the backend (when I deselect the resource that was already populated on the resourceCombo) with a phantom id and a null eventId and null resourceId, and it's causing a lot of issues.

Also, should the phantomId be on the Id field?

Screenshot 2021-06-08 171808.png
Screenshot 2021-06-08 171808.png (40.73 KiB) Viewed 129 times

Also of note, when I do not remove or add any more resources and I leave just the resource that the resourceCombo pre-selects, when I save that new event there isn't a corresponding assignment for it sent to the backend and I end up with an event with no assignments for it.

Screenshot 2021-06-08 175920.png
Screenshot 2021-06-08 175920.png (28.77 KiB) Viewed 129 times

Post by mats »

Can you reproduce this in the latest nightly? Sounds similar to a bug that was recently fixed.

Tired of debugging javascript errors in web applications? Try our powerful error logging service RootCause


Post by joversdev »

Ah, so I tried it with the nightly build and I can confirm that the bugs regarding assignments working incorrectly seems to be fixed.

However I still have the issue where the resource is appearing before I've selected any. When this event is sent with just the pre-selected resource (I made the resource combo a required field) and I then reload the calendar, that event wont have a resource on it as there wasn't one actually sent. My config is straight forward for that field:

resourceField: {
          name: "resourceCombo",
          label: "Assigned Providers",
          multiSelect: true,
          required: true,
        },

If that phantom resource actually existed in the data when it was sent, this wouldn't be an issue, but I'd prefer the resource list be empty when I open the editor to make a new event. Could an issue with the data in the resourceStore that I pass to it potentially cause the resourceCombo to have strange behavior like that? I can deselect the resource, send the event, and then later add the resource on just fine though. It's all very weird.

Edit: Something else of note, when using the eventRenderer and viewing the resourceRecord for an event with multiple resources (just console.log), I only see one resourceRecord.


Post by mats »

However I still have the issue where the resource is appearing before I've selected any.

This is the intended behavior, if no defaultCalendar is provided we choose the first record in the resource store (similar to how popular OS calendars work).

Edit: Something else of note, when using the eventRenderer and viewing the resourceRecord for an event with multiple resources (just console.log), I only see one resourceRecord

Can you please start a new thread for this issue and show your code so we can investigate? You should use this accessor:
https://bryntum.com/docs/calendar/#Scheduler/model/EventModel#property-resources

Tired of debugging javascript errors in web applications? Try our powerful error logging service RootCause


Post by joversdev »

Done.

But on this issue, I realize that that may be the intentional behavior, and its really not so much an issue that a resource is pre-selected, its the fact that the pre-selected resource doesn't seem to serialize in the assignments like every other resource does. I can attach the resource to a resource field on the event and achieve a work-around but that's sub-optimal and inconsistent when every other resource seems to be serialized under assignments.


Post by mats »

Now I see what you mean, it's a bug and we'll fix it: https://github.com/bryntum/support/issues/3004

Tired of debugging javascript errors in web applications? Try our powerful error logging service RootCause


Post Reply