Premium support for our pure JavaScript UI components


Post by david10sing »

Hi and thank you for your reply.

What would I then need to do to add intervals to the 'weekends' calendar?


Post by pmiklashevich »

Pavlo Miklashevych
Sr. Frontend Developer


Post by david10sing »

Hi pmiklashevich

I've gone through the links you pasted but how do I use it?

Do we do

project.calendarManagerStore.addInterval

?


Post by pmiklashevich »

addInterval is a function on Calendar model. CalendarManagerStore is a tree store which holds Calendar models. So you need to find the calendar you want to modify, call addInterval on it, and pass a config which describes CalendarIntervalModel. To find a calendar you can use getById, findRecord, etc. For example, if there is a calendar with id "weekends" you can do:

// The 1st of Jan is a holiday
project.calendarManagerStore.getById('weekends').addInterval({
    startDate : '2021-01-01',
    endDate : '2021-01-02',
    isWorking : false
})

Basically, you can find the info above in this guide: https://www.bryntum.com/docs/gantt/#guides/calendars.md#availability-intervals

Please describe what problem you're trying to solve. How do you use calendars in your project? Do you have one calendar for the project and resources and only want to provide an option to add holidays to the main calendar?

Pavlo Miklashevych
Sr. Frontend Developer


Post by david10sing »

Hi pmiklashevich,

My question is how to use Calendar. We offer our users to create calendar but on the Scheduler, we just want to display the holidays and I am doing a fetch for the holidays for a specific client and then trying to add it to the project calendar so that the event can skip the holidays.

Also, it looks like that the types are not correct.

// eslint-disable-next-line
// @ts-ignore
          pulseProject.calendarManagerStore
            .getById('weekends')
// eslint-disable-next-line
// @ts-ignore
            .addInterval({ startDate: new Date(2021, 0, 15), endDate: new Date(2021, 0, 15), isWorking: false });

I'm getting a type error on addInterval

Also could I ask why the interval has to be 1 day after? The normal grid does not have that behaviour. If booking start and endDate is 01/01/2021, it will display properly...


Post by pmiklashevich »

Hello!

My question is how to use Calendar. We offer our users to create calendar but on the Scheduler, we just want to display the holidays and I am doing a fetch for the holidays for a specific client and then trying to add it to the project calendar so that the event can skip the holidays.

If you have a calendar per client, you can download the calendar and use it as the main calendar for the project. If your project has some common rules for all clients, the user calendar can extend the common calendar (when it is a child of the calendar).

I'm getting a type error on addInterval

We will check and fix the typings.

Also could I ask why the interval has to be 1 day after? The normal grid does not have that behaviour. If booking start and endDate is 01/01/2021, it will display properly...

This is how time on the timeline works. 01/01/2021 means a point on the timeline 2021-01-01 00:00:00. If you need a time range of one day, you need to produce 2 points on the timeline to have 24 hours in between. Nevertheless you can display end date -1day on the screen. That is up to your application.

Best,
Pavel

Pavlo Miklashevych
Sr. Frontend Developer


Post Reply