Add, remove and edit blocked event in scheduler


Hi,

I would like to know how to add and remove blocked slots in the scheduler.


But I would like to allow user click blocked slot to edit it and click available slot to create blocked slot.

Thank you



1 Reply

SK Satheesh Kumar Balasubramanian Syncfusion Team July 21, 2022 02:28 PM UTC

Hi Calvin,

 

Currently, we don’t have the option to add, remove and edit block events. But, you can use eventRendered event to bind click action for the block event and you can open your customized dialog in the click action there you can edit or delete the block appointment. You can use the cellClick or cellDoubleClick of the schedule event to add the block appointment.

 

app.component.ts:

  public onEventRendered(args: EventRenderedArgs): void {

    if (args.type === 'blockEvent') {

      // Binding click event

      EventHandler.add(args.element, 'click', this.blockEventClick.bind(this));

    }

  }

  public blockEventClick(args: Event) {

    const blockAppCollection = this.scheduleObj.getBlockEvents();

    const blockEventData = blockAppCollection.filter(

      (event: { [key: string]: {} }) =>

        event.Id ===

        parseInt(

          (args.target as HTMLElement)

            .getAttribute('data-id')

            .replace('Appointment_', ''),

          10

        )

    )[0];

    if (blockEventData) {

      // You can open your customized dialog

    }

  }

 

Kindly try the above sample and let us know if this meets your requirement.


Regards,
Satheesh Kumar B

Loader.
Up arrow icon