Create events with IsBlock dynamically

HI, 

is it possible to make the schedule timeline block all cells with no events? i have an event from 2pm to 5pm, is it possible to make the schedule block all the empty cells with IsBlock events? Is there an option for this?


3 Replies

SK Satheesh Kumar Balasubramanian Syncfusion Team September 8, 2023 03:12 PM UTC

Hi Alexis,

Yes, it is possible to block a set of dates or a particular time ranges on the scheduler. To do so, define an appointment object within eventSettings along with the required time range to block and set the isBlock field to true.


[datasource.ts]

 

export let blockData: Object[] = [
    {
        Id: 1,
        Subject: 'Not Available',
        StartTime: new Date(2021, 7, 2, 10, 0),
        EndTime: new Date(2021, 7, 2, 12, 0),
        IsAllDay: false,
        IsBlock: true,
        EmployeeId: 1
    }, {
        Id: 2,
        Subject: 'Not Available',
        StartTime: new Date(2021, 7, 2, 16, 0),
        EndTime: new Date(2021, 7, 2, 20, 0),
        IsAllDay: false,
        IsBlock: true,
        EmployeeId: 2
    }, {
        Id: 3,
        Subject: 'Not Available',
        StartTime: new Date(2021, 7, 2, 12, 0),
        EndTime: new Date(2021, 7, 2, 14, 0),
        IsAllDay: false,
        IsBlock: true,
        EmployeeId: 3
    }, {
        Id: 4,
        Subject: 'Not Available',
        StartTime: new Date(2021, 7, 5, 11, 0),
        EndTime: new Date(2021, 7, 6, 10, 0),
        IsAllDay: true,
        IsBlock: true,
        EmployeeId: 4
    }, {
        Id: 5,
        Subject: 'Not Available',
        StartTime: new Date(2021, 7, 11, 11, 0),
        EndTime: new Date(2021, 7, 13, 10, 0),
        IsAllDay: false,
        IsBlock: true,
        EmployeeId: 5
    }, {
        Id: 6,
        Subject: 'Not Available',
        StartTime: new Date(2021, 7, 9),
        EndTime: new Date(2021, 7, 12),
        IsAllDay: false,
        IsBlock: true,
        EmployeeId: 6
    }, {
        Id: 9,
        Subject: 'Client Meeting',
        StartTime: new Date(2021, 7, 4, 8, 0),
        EndTime: new Date(2021, 7, 4, 10, 30),
        IsAllDay: false,
        EmployeeId: 3
    }, {
        Id: 10,
        Subject: 'Conference',
        StartTime: new Date(2021, 7, 3, 13, 30),
        EndTime: new Date(2021, 7, 3, 15, 0),
        IsAllDay: false,
        EmployeeId: 4
    }, {
        Id: 11,
        Subject: 'Employee Recruitment',
        StartTime: new Date(2021, 7, 2, 10, 0),
        EndTime: new Date(2021, 7, 2, 13, 0),
        IsAllDay: false,
        EmployeeId: 5
    }, {
        Id: 12,
        Subject: 'Data Analyzing',
        StartTime: new Date(2021, 7, 2, 15, 0),
        EndTime: new Date(2021, 7, 2, 17, 0),
        IsAllDay: false,
        EmployeeId: 6
    }, {
        Id: 13,
        Subject: 'Content Writting',
        StartTime: new Date(2021, 7, 3, 14, 0),
        EndTime: new Date(2021, 7, 3, 16, 0),
        IsAllDay: false,
        EmployeeId: 1
    }, {
        Id: 14,
        Subject: 'Meeting',
        StartTime: new Date(2021, 7, 2, 9, 0),
        EndTime: new Date(2021, 7, 2, 11, 0),
        IsAllDay: false,
        EmployeeId: 4
    }, {
        Id: 15,
        Subject: 'Not Available',
        StartTime: new Date(2021, 7, 30, 11, 0),
        EndTime: new Date(2021, 8, 1, 10, 0),
        IsAllDay: false,
        IsBlock: true,
        EmployeeId: 4
    }, {
        Id: 16,
        Subject: 'Not Available',
        StartTime: new Date(2021, 7, 12),
        EndTime: new Date(2021, 7, 15),
        IsAllDay: false,
        IsBlock: true,
        EmployeeId: 3
    }
];

Regards,
Satheesh


AG alexis garcia September 26, 2023 08:33 AM UTC

Hi, yes i know about isBlock, what i meant is if there is a way to pass like a time range and everything out of that time range will be blocked? ex. i pass an event from 12:00 to 16:00 everything else automatically is blocked

Is there a way to automatically do that or i we have to create the events and then pas



SK Satheesh Kumar Balasubramanian Syncfusion Team September 27, 2023 10:26 AM UTC

Hi Alexis,
No, it is not possible to block the cells automatically. You need to create an appointment from 12:00 to 16:00 and set the isBlock field to achieve your requirement.
Regards,
Satheesh

Loader.
Up arrow icon