We are using the Bryntum Calendar to display and edit events that are already available on the client-side. For event change tracking, we are utilizing the CrudManager
and its hasChanges
callback. However, we are encountering unexpected behavior when using hasChanges
, as demonstrated in the following code snippet.
calendar = new Calendar({
appendTo: calendarElement,
crudManager: {
listeners: {
hasChanges({ source: crudManager }) {
console.log('hasChanges', crudManager.changes);
crudManager.acceptChanges();
// sendAllEventsToRemoteServer();
},
},
},
});
Steps to Reproduce:
- Initialize the Bryntum Calendar with the
CrudManager
andhasChanges
listener. - Add a new event via the event editor and click "save."
- Expected: The
hasChanges
callback is triggered, andcrudManager.changes
contains an entry for the newly added event with aphantomId
. - Action: We call
crudManager.acceptChanges()
to consume the changes.
- Expected: The
- Create a second event by dragging in the calendar.
- Unexpected behavior: The
hasChanges
callback fires again, but this timecrudManager.changes
contains an entry for the event that was previously saved in step 2, despite the call toacceptChanges()
.
- Unexpected behavior: The
Expected Behavior:
When calling crudManager.acceptChanges()
, we expect the changes from the previous event to be consumed and cleared. The crudManager.changes
should not include the already added event when creating a new one.
Actual Behavior:
After calling acceptChanges()
following the addition of the first event, the hasChanges
callback is triggered again when creating a new event, and the crudManager.changes
object unexpectedly contains the same event from the previous step.
Environment:
- Bryntum Calendar Version: 6.0.5
- Browser: Chrome
- OS: Windows 10