Premium support for our pure JavaScript UI components


Post by tobias.aires »

Hello, i'm trying to use RecurringEvents of scheduler pro v5.3.0. First, i want to know if it is possible to change the name of recurring event? For example, i have "Task #1" as my main task, and the recurring ones be "Task #2", "Task #3" and so one. The other situation is the only one event is been sent when i tried to save my task using the load function.

Attachments
Screenshot from 2023-03-03 18-30-11.png
Screenshot from 2023-03-03 18-30-11.png (113.47 KiB) Viewed 930 times

Post by Animal »

The EventModel instances of recurring events which the EventStore returns when asked for a block of events between two dates are generated on an as needed basis when a new time block is requested which contains occurrences.

They are the same event just cloned and on a different date.

If it's just the UI to look different, I recommend using an eventRenderer to change the look of events which are occurrences.

https://www.bryntum.com/products/scheduler/docs/api/Scheduler/view/Scheduler#config-eventRenderer

https://www.bryntum.com/products/scheduler/docs/api/Scheduler/model/EventModel#property-isOccurrence


Post by Animal »

We could allow apps to intervene in the creation of occurrences: https://github.com/bryntum/support/issues/6317


Post by Animal »

Maybe use the renderer like this:

    eventRenderer({ renderData, eventRecord }) {
        if (eventRecord.isOccurrence) {
            // Mutate record silently so that calculation engine is not activated
            eventRecord.setData('name', `${eventRecord.recurringTimeSpan.name} ${eventRecord.occurrenceIndex}`);
        }
        return StringHelper.xss`${eventRecord.name}`;
    }

If your base event actually has #1 at the end you'd have to detect that yourself and do right things in your own code. This is just a hint.


Post by tobias.aires »

Hello again, i was able to change de UI by using the eventRenderer function above, thanks for the help.

But, i need to send to my backend all recurring events. If i say the some event has to repeat daily five times, i need to send those 5 events and theirs startDate and endDate on my request. Looking to some internals functions i've found this method on EventRecord class, convertToRealEvent. Is it possible to use this function on any part on my codebase? I've tried to use on eventRenderer but a infinite loop occurs and the browser tab freeze.


Post by Animal »

Those events don't really exist though. Only the base should exist. If you are creating actual events, then you are not using recurring events. You are just creating multiple events.


Post by tobias.aires »

But when i tried to edit some recurring event and choose to edit only this event a new event is created. I'm trying to reproduce, in some way, this behavior.


Post by tobias.aires »

How can i allow my user to create multiple events the repeat periodically?


Post by Animal »

occurrence.recurrenceRule = null;

Should convert it to a normal event.

Obviously, for that occurrence date you will have to add an exception date to the base. Otherwise next time you load, the occurrence will be injected there as well as the new one you just created from the original occurrence.

https://bryntum.com/products/calendar/docs/api/Scheduler/model/EventModel#field-exceptionDates


Post by Animal »

tobias.aires wrote: Wed Mar 22, 2023 5:29 pm

How can i allow my user to create multiple events the repeat periodically?

It's part of the editor:

Screenshot 2023-03-22 at 16.38.15.png
Screenshot 2023-03-22 at 16.38.15.png (41.63 KiB) Viewed 842 times

Post Reply