Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with rendering recurring events with multi assign #7821

Closed
marciogurka opened this issue Nov 7, 2023 · 1 comment
Closed

Issue with rendering recurring events with multi assign #7821

marciogurka opened this issue Nov 7, 2023 · 1 comment
Assignees
Labels
bug Something isn't working forum Issues from forum large-account Reported by large customer resolved Fixed but not yet released (available in the nightly builds)
Milestone

Comments

@marciogurka
Copy link

Forum post

Using the following example, in the first load we have the events loaded correctly, and after triggering removeAll and trying to load the same way, we have different results.

import '../_shared/shared.js'; // not required, our example styling etc.
import SchedulerPro from '../../lib/SchedulerPro/view/SchedulerPro.js';
import '../../lib/Core/widget/Label.js';
import '../../lib/Scheduler/column/ResourceInfoColumn.js';
import EventModel from '../../lib/SchedulerPro/model/EventModel.js';
import ResourceModel from '../../lib/SchedulerPro/model/ResourceModel.js';

const events = [
    {
        id             : 'e1',
        startDate      : new Date(2023, 9, 25, 9),
        endDate        : new Date(2023, 9, 25, 12),
        name           : 'Multi assigned',
        type           : 'multi',
        resourceIds    : ['r1', 'r2', 'r5'],
        recurrenceRule : 'FREQ=MONTHLY;INTERVAL=1;BYMONTHDAY=4;COUNT=5;'
    },
    {
        id         : 'e2',
        startDate  : new Date(2023, 9, 25, 8),
        endDate    : new Date(2023, 9, 25, 10),
        name       : 'Single assigned',
        type       : 'single',
        resourceId : 'r3'
    },
    {
        id         : 'e3',
        startDate  : new Date(2023, 9, 25, 15),
        endDate    : new Date(2023, 9, 25, 20),
        name       : 'Single assigned',
        type       : 'single',
        resourceId : 'r4'
    }
];

const resources = [
    {
        id          : 'r1',
        name        : 'Alex',
        description : 'Manager'
    },
    {
        id          : 'r2',
        name        : 'Alan',
        description : 'Worker'
    },
    {
        id          : 'r3',
        name        : 'Andrew',
        description : 'Worker'
    },
    {
        id          : 'r4',
        name        : 'Adam',
        description : 'Worker'
    },
    {
        id          : 'r5',
        name        : 'Ashley',
        description : 'Worker'
    }
];

export class CustomEventModel extends EventModel {
    static get $name() {
        return 'CustomEventModel';
    }

    static get fields() {
        return [
            {
                name : 'type',
                type : 'string'
            },
            {
                name    : 'resourceIds',
                persist : true
            }
        ];
    }

    constructor(config) {
        super(config);
        this.type = config?.type || '';
    }
}

class CustomResourceModel extends ResourceModel {
    static get $name() {
        return 'CustomResourceModel';
    }

    static  get fields() {
        return [
            {
                name : 'description',
                type : 'string'
            }
        ];
    }

    constructor(config) {
        super(config);
        this.description = config?.description || '';
        this.image = false;
    }
}

const
    schedulerPro = new SchedulerPro({
        appendTo   : 'container',
        startDate  : new Date(2023, 9, 22, 0),
        endDate    : new Date(2023, 11, 4, 0),
        viewPreset : 'weekAndDayLetter',
        columns    : [
            {
                type           : 'resourceInfo',
                text           : 'Name',
                field          : 'name',
                showEventCount : false,
                width          : 150
            }
        ],
        enableRecurringEvents : true,
        resourceStore         : {
            modelClass : CustomResourceModel
        },
        eventStore : {
            modelClass : CustomEventModel
        },

        resources : [],
        events    : []
    });

setTimeout(() => {
    schedulerPro.resourceStore
        .addAsync(resources)
        .then(() => schedulerPro.eventStore.addAsync(events));
}, 2000);

setTimeout(() => {
    schedulerPro.eventStore.removeAll();
    schedulerPro.eventStore.addAsync(events).then(() => {
        console.log('reloaded');
    });
}, 5000);
07.11.2023_13.37.18_REC.mp4
@marciogurka marciogurka added bug Something isn't working forum Issues from forum large-account Reported by large customer labels Nov 7, 2023
@egorkel-altexsoft
Copy link

Hi, any updates on this?

@matsbryntse matsbryntse self-assigned this Jan 7, 2024
@matsbryntse matsbryntse added ready for review Issue is fixed, the pull request is being reviewed resolved Fixed but not yet released (available in the nightly builds) and removed ready for review Issue is fixed, the pull request is being reviewed labels Jan 8, 2024
@matsbryntse matsbryntse added this to the 5.6.6 milestone Jan 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working forum Issues from forum large-account Reported by large customer resolved Fixed but not yet released (available in the nightly builds)
Projects
None yet
Development

No branches or pull requests

3 participants