Our powerful JS Calendar component


Post by kevinschweikert »

Hi,

when i use the https://bryntum.com/products/calendar/docs/api/Calendar/feature/CalendarDrag#config-validateResizeFn and want to access the recurrenceRule field, it does not work. However it does on the validateMoveFn.

This is the Config you can use in the Basic Demo: https://bryntum.com/products/calendar/examples/basic/

To reproduce the error, create a new recurring event. When one event gets moved the console prints the recurrenceRule. When you resize an event, the recurrenceRule is null.

import { Calendar } from '../../build/calendar.module.js?468679';
import shared from '../_shared/shared.module.js?468679';

const calendar = new Calendar({
    // Start life looking at this date
    date : new Date(2020, 9, 12),

// CrudManager arranges loading and syncing of data in JSON form from/to a web service
crudManager : {
    autoLoad  : true,
    transport : {
        load : {
            url : 'data/data.json'
        }
    }
},

listeners: {
        beforeDragMoveEnd: async ({ eventRecord, validation }) => {
            return false;
        },
        beforeDragResizeEnd: async ({ eventRecord, validation }) => {
            return false;
        }
    },

appendTo : 'container',

// Features named by the properties are included.
// An object is used to configure the feature.
features : {
    drag: {
            async validateResizeFn({ eventRecord, drag }) {
                console.log(eventRecord.recurrenceRule)
            },
            async validateMoveFn({ eventRecord, drag }) {
                console.log(eventRecord.recurrenceRule)
            }
}}        
});

Post by marcio »

Hey kevinschweikert,

Thanks for the report and the example. I created a ticket to fix that https://github.com/bryntum/support/issues/7042

Please follow the ticket to get updates.

Best regards,
Márcio


Post by Animal »

You can interrogate drag.peek('eventRecord')


Post by kevinschweikert »

Hey animal,

thanks, that would give me the event with the recurrenceRule set. But the startDate and endDate fields are the ones from before the drag operation. That makes it tedious to get start and end times from the eventRecord in the function argument and get the rest of the data from the drag.peek function.
I would've expected, that the eventRecord in the callback argument would already be filled with all the original field. But nonetheless it's a valid workaround, thanks!

Kevin


Post by marcio »

Hey Kevin,

Thanks for the feedback, we expect to work like you described when the ticket is finished.

Best regards,
Márcio


Post Reply